I am working with CustomMvcRouterHandler, Based on some logic I just want to redirect user to another Url from CustomHandler.
public class CustomMvcRouterHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
if (requestContext.HttpContext.Request.IsAuthenticated)
{
if (logic is true)
{
string OrginalUrl = "/Home/AboutUs";
// redirect Url = "/Home/CompanyProfile";
return new MvcHandler(requestContext);
}
}
return new MvcHandler(requestContext);
}
}
How to redirect user to "Home/CompanyProfile" from CustomRouterHandler ?
You can use underlying ASP.NET Response object to redirect user to another URL.
It will send redirect response to the browser and end HTTP request processing.