Solved

Share Cookie value between asp and aspx pages

Posted on 2004-04-23
7
191 Views
Last Modified: 2011-04-14
I have an application which has both asp and aspx pages. in one of my asp page say login page am storing the loginid in cookie. i am not able to read or write this cookie value from my aspx page
like i used
response.Cookies("member_id") = member_id in asp page

and in aspx page

Response.write(request.cookies("member_id"))
but im not getting any values written

can anyone help me with this

Thanx in adavance
0
Comment
Question by:tonykmathew
  • 3
  • 2
7 Comments
 
LVL 11

Expert Comment

by:rdrunner
ID: 10897354
You need to set the response.Cookies("Member_ID").path property so its below the asp and aspx page...

If you dont set this property it will default to the ASP path and if the aspx path is in another folder it wont be able to see it



Hope this helps
0
 

Author Comment

by:tonykmathew
ID: 10897927
I dint get u clearly...where shall i set the path???...any smaple code?
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 10898011
You need to set the path like this...


response.Cookies("Member_ID").path = "/mypath"
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:tonykmathew
ID: 10898035
thanx for ur help..but i got it worked in another way

In asp
response.Cookies("memberid") = member_id

In aspx
Response.Write(Request.Cookies("memberid").Value())

the '_'  in meber_id was giving me error!!! "object not set to an instance of an object!" dono why..but working now :)
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 10898128
Setting a Virtual Path for the Cookie
The Path property sets the path that this cookie pertains to. The cookie will only be retrieved from the client if pages are retrieved from the directory set by Path.

The syntax for setting the Path property of a cookie is:

    Response.Cookies("CookieName").Path = /VirtualPathThe following sets the cookie's path.

    Response.Cookies("User").Path = "/customers"

If the Path property is not specified it will be set to the directory where the cookie was created. Setting a Path of root, "/", causes the cookie to be sent to the server throughout the site.

Here is the long version :)
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 11130978
PAQed, with points refunded (50)

GhostMod
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Converting C# Objects into JSON file 7 64
Showdialog 8 29
Red error squiggly on vb.net 7 27
C# Single Form 8 26
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short film showing how OnPage and Connectwise integration works.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now