If using Cookies Inline in ASP page is Safe???

A

Amit Jamgade

Hi,

I am making use of cookies to store the Session State information
through JavaScript as given below in an ASP Page. Suppose I have XYZ.asp
page. The code in this page goes as shown below.
*********************************************************
<%
'Remark: ASP Code here
dim staffID
dim TaskCD
set objFile = server.CreateObject("PTSUFILE.PTSUFILESRV")
%>
<Script language="JavaScript">
var environment;
var physicalpath;
var userid;

environment = window.opener.document.FORM.as_environment.value;
physicalpath = window.opener.document.FORM.as_physicalpath.value;
userid = window.opener.document.PTSFORM.as_userid.value;

document.cookie="Environment=" + environment + "";
document.cookie="PhysicalPath=" + physicalpath + "";
document.cookie="UserID=" + userid + "";

</Script>
<%
'Remark:ASP Code Continues Here
'Remark:Get the physical path from cookies and set cookievalue to blank.

Dim physicalpath
physicalpath = Request.Cookies("physicalpath")
Session("StrPhysicalPath") = Cstr(physicalpath)
Response.Cookies("physicalpath")= ""

*********************************************************

Here I am trying to get the Session data from an previous page into a
new opened window ASP page throuh javascript.

And I am doing it so becos, I am sharing my session data across asp and
aspx pages in the same application. So i have a custom session object
which I fetch and store in oracle 9i database each time a request is
made to webserver.

I just want to know if I set the Response.Buffer Property on the top of
asp page to true. And use the above inline JavaScript code to store data
like Path, UserId in cookies. Again then fetch this data immediately in
the next line in ASP code from cookies and then set the cookies to
nothing. Is this way of using Cookies to store the session data is safe.
As I am immediately destrying the cookie data once I get it in my asp
page for use.

Please reply ASAP...
Thanks in Advance !
Regards,
Amit
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top