使用#placeholder重定向到页面

时间:2011-01-07 08:24:04

标签: c# asp.net

我在一个页面中有一个#placeholder。我想重定向到这个页面,形成一个链接,应该把我带到#placeholder section.in firefox这很好用,但是我没有得到#placeholder

我的重定向逻辑

 - string path =
   HttpContext.Current.Request.RawUrl + 
   #placeholder; 
   Response.Redirect("{0}?ReturnUrl={1}",
   Server.Encode(path), Server.Encode(path))));

任何想法???

1 个答案:

答案 0 :(得分:1)

将其包含在您的Response.Redirect中:

Response.Redirect(string.Format("{0}?ReturnUrl={1}#{2}",
   Server.Encode(path), Server.Encode(path), placeholder))));

(FWIW:这在技术上称为锚)

相关问题