ASP No Cache

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
 
S

Steve C. Orr [MVP, MCSD]

Try this code:

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

C Elson

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>
 
A

Alvin Bruney

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
 
C

C Elson

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%>
 
A

Alvin Bruney

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top