我正在尝试在路线中添加其他参数
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"CustomRoute",
"{controller}.mvc/{action}/{id}/{recid}",
new { action = "Index", id = "", recid = UrlParameter.Optional }
);
routes.MapRoute(
"Root",
"",
new { controller = "Account", action = "Index", id = "", recid =
UrlParameter.Optional
);
具有/ controller / action / id的页面正确呈现,但是当我使用/ controller / action / id / recid调用页面时,我在下面的函数中没有获得RouteData.Values中的正确值。 RouteData.Values最初具有正确的值。但是在该函数之后再次调用自身并且RouteData.Values有三个值而不是四个并且在id字段中有prompt.js
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
base.Initialize(requestContext);
var RouteValue = requestContext.RouteData.Values;
String p = RouteValue.ToString();
this._DocumentID = String.IsNullOrEmpty(RouteValue["id"].ToString()) ? 2 : Convert.ToInt32(RouteValue["id"]);
FormsIdentity ident = User.Identity as FormsIdentity;
if (ident != null)
{
FormsAuthenticationTicket ticket = ident.Ticket;
UserData = ticket.UserData;
this._UserID = Convert.ToInt32(UserData.Split('|')[0]);
this._RoleID = Convert.ToInt32(UserData.Split('|')[1]);
this._EmployeeID = Convert.ToInt32(UserData.Split('|')[2]);
}
}
答案 0 :(得分:0)
您呈现的页面中包含一个ressource prompt.js。删除此文件或更改路由以忽略以.js结尾的请求。