Kuttan Sujith
Kuttan Sujith

Reputation: 7979

set tempdata in from Global.asax

How can i set tempdata in from Global.asax?

asp.net-mvc-2

Upvotes: 0

Views: 1558

Answers (1)

Kuttan Sujith
Kuttan Sujith

Reputation: 7979

Dictionary<string, object> tempDataDictionary = Context.Session["__ControllerTempData"] as Dictionary<string, object>;
                if (tempDataDictionary == null)
                {
                    tempDataDictionary = new Dictionary<string, object>();
                }
                **tempDataDictionary["TopMessage"] = message;
                tempDataDictionary["FromUnauthorized"] = true;
                HttpContext.Current.Session["__ControllerTempData"] = tempDataDictionary;**
                Server.ClearError();
                Response.Redirect("~/Account/LogOn");

Upvotes: 4

Related Questions