[英]RouteData.Values null redirect
I want to redirect to the main page if the incoming value is unknown or empty. 如果输入值未知或为空,我想重定向到主页。 But I did not succeed. 但是我没有成功。
if(RouteData.Values["lab"] ==null )
{
Response.Redirect("/Default");
}
This is what I did to redirect to my error page, via the controller, when authenticating LDAP groups: 这是在验证LDAP组时通过控制器重定向到错误页面的操作:
var routeData = new RouteData();
routeData.Values.Add("message", errorModel.message);
routeData.Values.Add("action", "Index");
routeData.Values.Add("controller", "ErrorPage");
IController ctrl = new ErrorController();
ctrl.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));
Response.End();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.