Groups | Blog | Home
all groups > asp.net > november 2003 >

asp.net : ASP No Cache



Steve C. Orr [MVP, MCSD]
11/1/2003 4:42:33 PM
Try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



[quoted text, click to view]

C Elson
11/1/2003 10:23:27 PM
I was hoping someone can help me out.

I've searched the pages here and on numerous sites and cannot find an
answer that works. I'm trying this code RC4 Encryption/Decryption
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6646&lngWId=4

But there is no way (I can find) to clear the script afterwards. I'm
trying to make it secure and when I try Back buttons I can still see
the original code. I've tried all I could find for no-cache scripts
but none seem to work.

I'm a novice at ASP and so it's been a very frustrating journey. If
anyone can help out thhat'd be great

Thanks
Steve C. Orr [MVP, MCSD]
11/2/2003 8:36:24 PM
I'd suggest you put those lines in your Page_Load event.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



[quoted text, click to view]

C Elson
11/2/2003 11:41:44 PM
I tried adding that but now the page didn't even open it. I added it
here:
---------------------------------
<HEAD>
<TITLE>RC4 Encryption</TITLE>
</HEAD>
<BODY>
<%
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
%>
<H1>RC4 Encryption</H1>
<P>
This script encrypts and decrypts messages
with the RC4
algorithm. Enter the key (password) and a
message to
encrypt or decrypt in the fields below.
</P>

------------------------------
Any ideas?

Thanks


On Sat, 1 Nov 2003 16:42:33 -0800, "Steve C. Orr [MVP, MCSD]"
[quoted text, click to view]
C Elson
11/3/2003 1:18:27 PM
I'm sorry but I'm such a newbie at ASP that I have no clue how to do
that.


On Sun, 2 Nov 2003 20:36:24 -0800, "Steve C. Orr [MVP, MCSD]"
[quoted text, click to view]
Alvin Bruney
11/3/2003 1:36:57 PM
search for your Page_Load function, and put the code in there. If you are
doing inline you would have to create the function with the correct
signature inside script tags

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
[quoted text, click to view]

Alvin Bruney
11/3/2003 7:30:32 PM
Modify your code to do this
<%
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
%>
change to

<%
private void Page_Load(object sender, System.EventArgs e)

{


Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
}
%>


--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
[quoted text, click to view]
href="http://www.rsasecurity.com/solutions/developers/total-solution/faq.htm
l">FAQ</A>.
[quoted text, click to view]

C Elson
11/4/2003 12:58:24 AM
On Mon, 3 Nov 2003 13:36:57 -0600, in
[quoted text, click to view]


There, to my knowledge isn't a Page_Load function. Here's the entire
code which calls forth another page that nowhere could I find a
Page_Load command:

<%@ Language=VBScript %>
<%Option Explicit%>
<!--#INCLUDE FILE="RC4.asp"-->
<%
Dim lStrKey
Dim lStrMessage
Dim lStrResult
If Request.QueryString("Action") = "Decrypt" Then
lStrKey = Request.Form("Key")
%>
Encrypted:<BR>
<%=Request.Form("Encrypt")%><BR>
Decrypted:<BR>
<TEXTAREA name="Decrypt" rows="3" cols="50"
DISABLED><%=Decrypt(Request.Form("Encrypt"),lStrKey)%></TEXTAREA>
<BR>
<%Else
If Not Request.Form = "" Then
lStrKey = Request.Form("Key")
lStrMessage = Request.Form("Message")
lStrResult = RC4(lStrMessage, lStrKey)
End If
%>
<HTML>
<HEAD>
<TITLE>RC4 Encryption</TITLE>
</HEAD>
<BODY>
<%
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
%>
<H1>RC4 Encryption</H1>
<P>
This script encrypts and decrypts messages
with the RC4
algorithm. Enter the key (password) and a
message to
encrypt or decrypt in the fields below.
</P>
<FORM method="Post">
Key: <INPUT name="Key"
value="<%=Server.HTMLEncode(lStrKey)%>"><BR>
<BR>
Message:<BR>
<TEXTAREA name="Message" rows="3"
cols="50"><%=Server.HTMLEncode(lStrResult)%></TEXTAREA>
<BR>

<INPUT type="Submit" value="Apply RC4"
id=Submit1 name=Submit1>
<BR>Now the above is all very well, but what
if you want to submit it to a SQL DB or something? Tada: Use the
Encrypt/Decrypt Methods!
</FORM>
<p>

<Form Action="demo.asp?Action=Decrypt"
Method=Post id=form1 name=form1>
Key: <INPUT
value="<%=Server.HTMLEncode(lStrKey)%>" DISABLED><INPUT Type="hidden"
name="Key" value="<%=Server.HTMLEncode(lStrKey)%>"><BR>
Encrypted Data for Submission to SQL:<BR>
<INPUT name="Encrypt"
value="<%=Encrypt(lStrMessage,lStrKey)%>" Type=Hidden>
<TEXTAREA rows="3" cols="50"
DISABLED><%=Encrypt(lStrMessage,lStrKey)%></TEXTAREA>
<Input type="Submit" Value="Decrypt"></Form>

<P>
Created by <A
href="http://www.lewismoten.com">Lewis Moten</A>. Modified by <A
href="mailto:shmarya@hotpop.com">Shmarya</A> for use in SQL Queries.
If you have questions about RCA and the
algorithms
that were released to the public domain, you
can read the
<A
href="http://www.rsasecurity.com/solutions/developers/total-solution/faq.html">FAQ</A>.
</P>
</BODY>
</HTML>
<%End If%>
AddThis Social Bookmark Button