1

I have a web application that I am working on where I create a cookie called "AuthCookie". I insert this cookie into the response as shown:

Response.Cookies.Add(authCookie);

I then redirect to another webapplication. In that webapplication, when i run the following code:

var test = Request.Cookies["AuthCookie"];

The cookie is null. I look in the list of cookies and "AuthCookie" is no longer there. In the web.config of this website, "AuthCookie" is the name of the Forms Authentication....

    <authentication mode="Forms" >
       <forms name="AuthCookie" loginUrl="https://localhost/Test/Authenticate" timeout="2" requireSSL="false" domain=""/>
    </authentication>

When I change the name of the cookie that I created to something else like...AuthCookie2, the the issue does not occur. When I am redirected to the second website, the cookie remains in tact and "Test" is not null.

My knowledge on Cookies is a bit weak when it comes to Forms Authentication. Can someone explain to me why this is happening? I've googled left and right, but to no avail. I also need to have the names remain the way they are. Simply changing the cookie name isn't an option for me.

TheFootClan
  • 165
  • 1
  • 3
  • 12

0 Answers0