Conditions: WinXP or WinServer 2008 R2, ASP.NET 4, ASP web application written using VS 2010 SP1, WCF self hosted server (part of bigger server). ASP.NET novice, but lots of programming experience. User login is handled in the application, not in authentication
service.
Everything works fine in VS host, IIS hosted Web Application, remote and local.
Problem: I need to send and receive and store cookies between the web app and the server. 3 days into research and I cannot find anything that explains SIMPLY how to go about this. I found one item about sending a cookie from the web app using Response.Cookies.Add(myCookie):
Fiddler says it never happened. How to read a cookie MIGHT work in the web app, it uses Request.Cookies(), but how do I send one from the server? No idea.
In the server, neither of these objects is available. I did find the HttpCookieSession example, but with absolutely NO documentation or ideas about how to use it, I'm lost. It does build, but I have tried everything that I can think of to set the authorization
to anonymous - but it still crashes!
It would be really nice if someone could direct me to a readable overview of how cookies are supposed to work, objects to use and why it is so complex and clumsy - or so it seems thanks to the documentation (VS 2010 AND vs2008).
Any help will be greatly appreciated. If this is in the wrong forum, please feel free to move it.
Thanks for the link. I found this item on a thread in the MSDN Forums:
"ASP.NET compatibility mode can only be used when your service is hosted in IIS and not with a self host hosted service. It is IIS that provides the HttpContext in this senario. If you are trying to use cookies for some sort of session state, consider using
Sessions with WCF. Sessions in WCF provide a great state management facility between client and service."
roadkill4299
Member
2 Points
13 Posts
send/receive cookies between aspx web application and wcf self hosted server
May 23, 2012 05:30 PM|LINK
Conditions: WinXP or WinServer 2008 R2, ASP.NET 4, ASP web application written using VS 2010 SP1, WCF self hosted server (part of bigger server). ASP.NET novice, but lots of programming experience. User login is handled in the application, not in authentication service.
Everything works fine in VS host, IIS hosted Web Application, remote and local.
Problem: I need to send and receive and store cookies between the web app and the server. 3 days into research and I cannot find anything that explains SIMPLY how to go about this. I found one item about sending a cookie from the web app using Response.Cookies.Add(myCookie): Fiddler says it never happened. How to read a cookie MIGHT work in the web app, it uses Request.Cookies(), but how do I send one from the server? No idea.
In the server, neither of these objects is available. I did find the HttpCookieSession example, but with absolutely NO documentation or ideas about how to use it, I'm lost. It does build, but I have tried everything that I can think of to set the authorization to anonymous - but it still crashes!
It would be really nice if someone could direct me to a readable overview of how cookies are supposed to work, objects to use and why it is so complex and clumsy - or so it seems thanks to the documentation (VS 2010 AND vs2008).
Any help will be greatly appreciated. If this is in the wrong forum, please feel free to move it.
roopeshreddy
All-Star
20143 Points
3327 Posts
Re: send/receive cookies between aspx web application and wcf self hosted server
May 24, 2012 07:20 AM|LINK
Hi,
I think in Filddler it should be available in Headers section!
Regarding Cookies, you can read this - http://msdn.microsoft.com/en-us/library/aa289495(v=vs.71).aspx
Hope it helps u...
Roopesh Reddy C
Roopesh's Space
roadkill4299
Member
2 Points
13 Posts
Re: send/receive cookies between aspx web application and wcf self hosted server
May 24, 2012 04:57 PM|LINK
Thanks for the response; I am using Fiddler 2: it breaks out the cookies into specific sections of the display.
The link is good, but in a WCF Self-hosted service, the Request and Response objects are deeply hidden, if they exist at all.
roopeshreddy
All-Star
20143 Points
3327 Posts
Re: send/receive cookies between aspx web application and wcf self hosted server
May 25, 2012 06:04 AM|LINK
Hi,
Is your problem solved or not?
Roopesh Reddy C
Roopesh's Space
FightAsABull
Contributor
2228 Points
424 Posts
Re: send/receive cookies between aspx web application and wcf self hosted server
May 25, 2012 06:56 AM|LINK
Hi, this will help:
http://msdn.microsoft.com/en-us/library/bb398778.aspx
roadkill4299
Member
2 Points
13 Posts
Re: send/receive cookies between aspx web application and wcf self hosted server
May 25, 2012 12:54 PM|LINK
Thanks for the link. I found this item on a thread in the MSDN Forums:
"ASP.NET compatibility mode can only be used when your service is hosted in IIS and not with a self host hosted service. It is IIS that provides the HttpContext in this senario. If you are trying to use cookies for some sort of session state, consider using Sessions with WCF. Sessions in WCF provide a great state management facility between client and service."