Using cookies to determine the last page visited

Discussion in 'ASP .Net' started by Anita C, Dec 23, 2003.

  1. Anita C

    Anita C Guest

    Hi,
    How cookies can be used to set and then determine the last page visited by a
    person browsing a particular website ? Also the page last visited is loaded
    in an iframe, so the page last visited inside a particular iframe is what
    really needs to be determined. So when the application starts up the next
    time, if the last page visited was admin.aspx inside frame IContent, then
    show admin.aspx in Icontent or else show home.aspx. A code sample or a link
    to the reqd. info. will be great.
    Thanks in advance.
     
    Anita C, Dec 23, 2003
    #1
    1. Advertising

  2. Anita C

    Hermit Dave Guest

    From MSDN sample code
    HttpCookie MyCookie = new HttpCookie("LastVisit");
    DateTime now = DateTime.Now;

    MyCookie.Value = now.ToString();
    MyCookie.Expires = now.AddHours(1);

    Response.Cookies.Add(MyCookie);

    Instead of writing time... write the URL

    you need to write a user control and add the control to all the pages that
    are loaded in the IContent frame. All the user control does is write the
    cookie of the page visited
    each page will over write the value written by the last one
    set the default page for the IContent frame to home page.. make sure home
    page has another code which does a check for that cookie... and if found...
    get the value... and redirect to that page...

    Not too bad is it ?

    HD

    "Anita C" <> wrote in message
    news:...
    > Hi,
    > How cookies can be used to set and then determine the last page visited by

    a
    > person browsing a particular website ? Also the page last visited is

    loaded
    > in an iframe, so the page last visited inside a particular iframe is what
    > really needs to be determined. So when the application starts up the next
    > time, if the last page visited was admin.aspx inside frame IContent, then
    > show admin.aspx in Icontent or else show home.aspx. A code sample or a

    link
    > to the reqd. info. will be great.
    > Thanks in advance.
    >
    >
     
    Hermit Dave, Dec 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tdi1686
    Replies:
    2
    Views:
    376
    Kevin Spencer
    Aug 13, 2003
  2. _Who
    Replies:
    7
    Views:
    2,721
  3. Drifter
    Replies:
    4
    Views:
    139
    Ray at
    Nov 20, 2003
  4. Replies:
    0
    Views:
    102
  5. Replies:
    1
    Views:
    139
Loading...

Share This Page