Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:32:07+00:00 2026-06-03T10:32:07+00:00

and thanks for taking the time to read my question. We will have visitors

  • 0

and thanks for taking the time to read my question. We will have visitors to the site that might arrive at another user’s profile page. We will then encourage them to login to the site, or register as new if they are not currently members. These actions move them pretty far away from that initial page/URL they stated on, but we want to be able to “jump them” back to that page after completing login/sign-up by “keeping track” where they began. (NOTE: we’re using the standard Microsoft membership provider classes, if it matters.) The “jumping back” part seems straightforward, it is the “keeping track” part that is the problem.

An illustration/example:

A visitor arrives at the site after clicking: http://www.mysite.com/profiles/ID=108

The visitor then leaves that page to login. How can we best capture the ID=108 somehow, so that there is a good option for the (logged-in) user to return to that profile page? I understand from reading that cookies are not optimal, but some of the other options seem to throw a monkey wrench into my thinking since the user is not yet logged-in, etc.

Any concrete steps that I can take to address this in the best MVC3 way?

EDIT:

    public ViewResult MyProfile(int? id)
    { 
    HttpCookie cookie = new HttpCookie("MySiteCookie");
    cookie.Value = id.ToString();
    cookie.Expires = DateTime.Now.AddYears(1); //or whatever time is appropriate
    System.Web.HttpContext.Current.Response.Cookies.Add(cookie);

    //do some other stuff
    }

At the other end, to make use of the cookie, I’ve put it into the menu (temporarily) in such a way:

    var MyProfileId = "";
    if (Request.Cookies["MySiteCookie"] != null)
    {HttpCookie cookie = request.Cookies["MySiteCookie"];
    MyProfileId = Server.HtmlEncode(cookie.Value);}

and then you put it into your link

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:32:19+00:00Added an answer on June 3, 2026 at 10:32 am

    I understand from reading that cookies are not optimal

    IMHO cookies are the best way to approach this. When an anonymous user lands on the profiles page simply emit a cookie containing the id of the profile that he is currently viewing. Then later when he successfully logs in read this cookie value to obtain the id and construct the redirect link and redirect him to this link.

    Another possibility is to use server side session but I am mentioning this just as an alternative to cookies and not at all as something that I would recommend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks in advance for taking the time to read my question. I'm using MySQL
Thanks for taking the time to read this. I have an unknown number of
Thanks everyone for taking the time to read this. I have styled my navigation
First, thanks in advance for taking the time to read through this. I have
thanks for taking the time to stop by my question. Below you will find
Thanks for taking time to read this question. I am designing a 3-tier solution
First of all, thanks for taking the time to read my question, I appreciate
thanks for the taking the time to read my question. I'm pulling information for
thank you for taking some time to read my question. I have this app
thanks in advance for taking the time to read through my question... /* Binary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.