Solved

Share Cookie value between asp and aspx pages

Posted on 2004-04-23
7
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

635 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