Solved

Share Cookie value between asp and aspx pages

Posted on 2004-04-23
7
183 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

12 Experts available now in Live!

Get 1:1 Help Now