How to set a session value in a link

Vote:
 

I'm trying to implement a temporary splash-page which will be shown if a session variable and a property is set to true. I check this variable in the default action, like so:

public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

	// warning page should be shown and the user hasn't dismissed it yet
	        if (model.Settings.ShowWarningPage && Session["SkipWarningPage"] == null)
	        {
				Session.Add("SkipWarningPage", false);
	        }
			if (model.Settings.ShowWarningPage && Session["SkipWarningPage"] != null && !bool.Parse(Session["SkipWarningPage"].ToString()))
			{
				if (model.Settings.TextWarningPage != null)
				{
					return View("Warning", model);
				}
	        }

			return View(model);
        }

Then I return the appropiate view depending on the result.

What I now need is to set the session value to false if the user clicks a link on the "Warning"-view page. The link should then point the user to the StartPage.

My problem is: How do you easiest make a link that sets the session value to true and redirects the user the the StartPage?

#120462
Apr 17, 2015 13:45
Vote:
 

Hi,

I will creat a new action where I will set the session value and will redirect where I require.

Regards
/K

#120466
Apr 17, 2015 15:35
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.