Is it possible to change the querystring variable in ASP.NET MVC path before it hits the controller?

后端 未结 4 877
甜味超标
甜味超标 2021-01-03 06:26

I have a controller method in ASP.NET MVC that looks like this:

public ActionResult GetAlbumPictures(int albumId)
{
    var album = AlbumRepo.GetSingle(album         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 06:36

    You can intercept the request before it hits the controller in Application_BeginRequest in your global.asax. You won't have access to the MVC contexts though, but could use

    Server.Transfer(...);
    

    or

    Response.Redirect(...); 
    Response.End();
    

提交回复
热议问题