locked
Default Request.Cookie["Proxy"] get created if Visual Studio 2010 open as administrator RRS feed

  • Question

  • User-50507118 posted

    HI All,

    I am working on visual studio 2010 express edition.

    I have one application developed in VC# MVC3 architecture.

    I used form authentication and when user login into application I store some usefull infomration like user fullname its user id in cookies.

    Below code to add cookies.

    FormsAuthentication.SetAuthCookie(model.UserName, true);

    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
    user.UserName,
    DateTime.Now,
    DateTime.Now.AddMinutes(60),
    isPersistent,
    user.FullName + "|" + user.UserId,
    FormsAuthentication.FormsCookiePath);

    string encTicket = FormsAuthentication.Encrypt(ticket);

    // Create the cookie.
    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));

    I am retriving same cookie info using below code.

    FormsAuthentication.Decrypt(Request.Cookies[0].Value).UserData;

     Code is working fine.

    BUT if I open VS 2010 as Administrator and try to run above appliction behaviour is different

    1) Request.Coookie[0] already exist (Proxy) and it store URL information.

    2) When my code create cookies it set as second cookies.

    So FormsAuthentication.Decrypt(Request.Cookies[0].Value).UserData; throw exception. 

    I can fatch cookie by cookie name but I just wanted to know why this proxy cookie get created only if I open VS 2010 as administrator.

    Appreciate for your time and response.

    Thanks,

    Saturday, April 6, 2013 9:09 PM

Answers

  • User-166373564 posted

    Hi,

    FormsAuthentication.Decrypt(Request.Cookies[0].Value).UserData; throw exception.  I can fatch cookie by cookie name but I just wanted to know why this proxy cookie get created only if I open VS 2010 as administrator.

    I'm not sure whether you use FormsAuthentication properly, as we know, FormsAuthenticationTicket provides access to properties and values of the ticket used with forms authentication to identify users.

    At the same time FormsAuthentication.SetAuthCookie creates an authentication ticket for the supplied user name and adds it to the cookies collection of the response, or to the URL if you are using cookieless authentication. It sets a browser cookie to initiate the user's session. It's what keeps the user logged in each time a page is posted to the server.

    I think you could refer the usage of FormsAuthentication Methods and FormsAuthenticationTicket Class first, and check whether it is helpful to troubleshoot,

    hope t helps you,

    With regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 12, 2013 1:04 AM