How to Redirect to view from global.asax?
Below is my code. It gives me HTTP Error 500.19 - Internal Server Error.
public void Application_BeginRequest(object sender, EventArgs e)
{
if (ConfigurationManager.AppSettings["MaintenanceMode"] == "true")
{
// if (!Request.IsLocal)
// {
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Server.ClearError();
Response.Clear();
HttpContext.Current.Response.Redirect("~/Views/Account/MaintenancePage.cshtml");
// }
}
}