3

MVC を初めて使用するので、質問があります。http モジュールでは、現在のリクエストが mvc ページ、つまりhttp://www.website.com/user/editからのものかどうかを調べるにはどうすればよいですか?

現在のコンテキストで確認できるものはありますか?

4

2 に答える 2

4

コントローラーとアクション名を取得できます....

var request = httpContext.Request.RequestContext.RouteData.Values;
string ActionName = request["Action"].ToString();
string ControllerName = request["Controller"].ToString();
于 2012-04-26T12:43:20.200 に答える
0

Referrer プロパティの使用を試みることができます

if(Request.UrlReferrer != null 
    && Request.UrlReferrer.PathAndQuery.StartsWith( "/User/Edit/" ))
{
    return View( "SomeOtherView" );
}
于 2012-04-26T15:21:32.963 に答える