Reading Cookies only returning SessionId cookie

G

Guest

I'm trying to read the cookies using HttpContext.Current.Request.Cookies, but
the only cookie that I get is the ASP.NET SessionId cookie. There are many
cookies on the machine, why am I only getting the one cookie?

Thanks,

- Stew
 
N

neilmcguigan

your browser only sends up the cookies for your site (yourhost.com for
example)
 
G

Guest

Yes, thank you, I realized that afterward. I am still having a problem though:

First of all I'm in a development environment, so the site name would just
be http://localhost. I am trying to write a cookie using the following code:

public static void Write( string cookieName, string cookieValue )
{
HttpCookie cookie = new HttpCookie( cookieName, cookieValue );
cookie.Expires = DateTime.Now.AddYears(1);
HttpContext.Current.Response.Cookies.Add( cookie );
}

The problem is that the cookie is only available for the time the browser is
open, it's not there the next time I try to read it, even though I've set an
expiration date.

The second issue, is there is another application that is creating a cookie
(an ASP app), which I need to read back. That application is redirecting to
my application )ASP.NET app), which exists on the same server, and is 'part'
of the ASP app in IIS. I can't seem to be able to read the cookie (not part
of Cookie collection) in my APS.NET app. Any ideas on this?

Thanks much
 
D

Daniel TIZON

Hi Stew,
Sorry, but cookies are not cross domain. A cookies written by Microsoft on a
client browser when you go on Microsoft Sites can't be read by Oracle when
you go on Oracle Site...
Cookies writtent by an application could be readen by another application
hosted with the same domain, for examples : www.microsoft.com/toto and
www.microsoft.com/titi
If you want to read permanent cookies written on a client machine, you could
read the following folder : C:\Documents and Settings\YourLoginNale\Cookies
 
G

Guest

Thank you Daniel... I did realize that after I posted a message. Please
check my response to the other poster above.

The main problem is being able to read a cookie created by the 'parent'
application, which is on the same domain. An ASP application is writing a
cookie, then redirecting to my ASP.NET home page. At that point, I need to
read back the cookie that the ASP app created. The ASP and ASP.NET
applications are both within the confines of the same parent directory on the
server, yet I still can't read the ASP app's cookie.

Any help would be greatly appreciated.

Thank you
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top