Firefox中的Server.UrlEncode撇号(') [英] Server.UrlEncode apostrophe(') in Firefox

查看:256
本文介绍了Firefox中的Server.UrlEncode撇号(')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个名为lnkTwitter的超链接:



我试图在后面的代码中设置url:

 lnkTwitter.NavigateUrl = string.Format(http://www.twitter.com/home?status={0},Server.UrlEncode(I'm Steven)); 

当我这样做并将鼠标悬停在链接上时,URL会在状态栏中正确显示为 http://www.twitter.com/home?status=I 'm + Steven,但实际的网址,如果我点击链接或查看链接的属性,是 http://www.twitter。 com / home?status = I%27m + Steven



由于某些原因,这只发生在Firefox中;在IE浏览器中,我被带到了正确的url。

解决方案

Firefox只喜欢使用它显示的网址。虽然这可能会引起混淆,但它不应该导致您的代码或链接到的网站(在这种情况下是twitter)出现任何问题。



如果您按照链接进行复制该网址并将其粘贴到记事本或其他东西,那么你应该得到实际使用的转义表单,而不是显示的非转义表单。


So I have a Hyperlink called lnkTwitter:

And I'm trying to set the url in the code behind:

lnkTwitter.NavigateUrl = string.Format("http://www.twitter.com/home?status={0}", Server.UrlEncode("I'm Steven"));

When I do that and hover over the link, the url displays correctly in the status bar as "http://www.twitter.com/home?status=I'm+Steven", but the actual url, if I click on the link or look at the link's properties, is "http://www.twitter.com/home?status=I%27m+Steven".

For some reason, this only happens in Firefox; in IE, I am taken to the correct url.

解决方案

Firefox just likes to unescape the urls that it shows. While this can be confusing it should not cause your code or the sites you link to (twitter, in this case) any problems.

If you follow the link and then copy the url and paste it into Notepad or something then you should get the escaped form that was actually used instead of the unescaped form that was displayed.

这篇关于Firefox中的Server.UrlEncode撇号(')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆