I'm working with ASP.net and MVC3 . I need to show a popup or go to the login page When the session get expired. Can any one please tell me How to redirect to login page which is having action name as "index" and the controller name as "Home".
My Code is:
This method is in my model.In this model I have to redirect to login page.
protected Product GetCurrentCorp(HttpContextBase context)
{
if (context.Session != null)
{
var selectedProduct = context.Session["SelectedProduct"];
if (selectedProduct != null)
{
var product= selectedProduct as Product;
return product;
}
}
// Here I need to redirect to index page(login page)
throw new ArgumentException("Product is not set, Cannot Continue.");
}