ASP No Cache

  • Thread starter Thread starter C Elson
  • Start date Start date
C

C Elson

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
 
Try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
 
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>
 
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
 
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


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:[email protected]">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%>
 
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
C Elson said:
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:[email protected]">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.htm
 
Back
Top