C#中得到完整的URL与"#" [英] c# get complete URL with "#"
问题描述
我一直试图让一个C#页面的整个URL时遇到一个平凡的(?)的问题。
I have run into a trivial(?) problem when trying to get the whole URL of a c# page.
URL包含# - 链接REF字符。我想,要当我抢网址
The url contains the "#"-link ref char. And i would like that to when I grab the URL
例如。 ? HTTP://localhost/site/page.aspx VAR = 1&放大器; VAR = 2#链接
我都试过Request.URL,等的Request.QueryString,它只返回到# - 字符
I have tried Request.URL, Request.Querystring etc, it only returns up to the "#"-char.
有什么办法抢到连最后一部分?
Is there any way to grab even the last part?
在此先感谢
推荐答案
您的问题是,#指定页面的锚,所以的浏览器的看到:
Your problem is that # specified an anchor in the page, so the browser sees:
HTTP://localhost/site/page.aspx VAR = 1&安培; VAR = 2
,然后查找在页面
<a name="link">anchor</a>
由于这是客户端,你需要从URL逃避# - 你不能得到它的服务器上,因为浏览器已经剥离其关闭
As this is client side you need to escape the # from the URL - you can't get it on the server because the browser's already stripped it off.
这篇关于C#中得到完整的URL与&QUOT;#&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!