Application_BeginRequest - save cookie

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hiddenhippo

    #1

    Application_BeginRequest - save cookie

    hi,

    i'm attempting to set a cookie which determines the last page that I
    visited within my aspx 1.1 application. It seemed to me that the most
    logical place would be within global.asax, and in particular within;
    for example

    protected void Application_Beg inRequest(Objec t sender, EventArgs e)
    {
    HttpCookie test = new HttpCookie("tes t");
    test.Values["Index"] = "POP";
    HttpContext.Cur rent.Request.Co okies.Add(test) ;
    }

    however this doesn't work. I really didn't want to code within each
    forms 'onload' event as that seemed like a manageable nightmare,
    especially when global.asax should fit the bill.

    Any help/idea would be greatly appreciated.

  • Alex Meleta

    #2
    Re: Application_Beg inRequest - save cookie

    Hi,

    Just set it for Response, not for Request.
    HttpContext.Cur rent.*Response* .Cookies.Add(te st)

    Regards, Alex
    [TechBlog] http://devkids.blogspot.com


    Comment

    • hiddenhippo

      #3
      Re: Application_Beg inRequest - save cookie

      On Sep 11, 10:18 am, Alex Meleta <amel...@gmail. comwrote:
      Hi,
      >
      Just set it for Response, not for Request.
      HttpContext.Cur rent.*Response* .Cookies.Add(te st)
      >
      Regards, Alex
      [TechBlog]http://devkids.blogspo t.com
      thanks for that. it seems that staring at the problem caused me to go
      blind. fresh pair of eyes helped big time. thanks again

      Comment

      Working...