2011-09-26 63 views
3

考慮一個控制器中下面的代碼:從aspnet mvc中的重定向中清除哈希和參數?

protected override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext) 
    { 
     if (!this.IsAuthorized) 
     { 
      filterContext.Result = RedirectToAction("Index", "Home", new { area = "" }); 
      //filterContext.Result = Redirect(Url.Content("~/Home/Index")); // Gives same result as the previous row 
      return; 
     } 

     base.OnActionExecuting(filterContext); 
    } 

如果我輸入的時候不授權如下網址:

somecontroller/someaction#/?tab=Foo 

我重定向到:

/Home/Index#/?tab=Foo 

怎麼來的散列沒有從網址中剝離?
我該如何擺脫它的serverside?

回答