开发者

Special character into querystring .NET

I need to send the follow querystring:

http://p开发者_JAVA百科rod.intranet.siemens.com.br/drvs/index.aspx?page=2&pag=4&varpatch=%20C:\Documents%20and%20Settings\OPE253\My%20Documents\Ca$@#!

Then i try to assing this to a string,but .NET break string at

   http://prod.intranet.siemens.com.br/drvs/index.aspx?page=2&pag=4&varpatch=%20C:\Documents%20and%20Settings\OPE253\My%20Documents\Ca$@

'#" do not appears in querystring

Any ideas?


No, because "#" is a reserved character. It's used to link to a specific location in a web page:

http://en.wikipedia.org/wiki/HTML_anchor#Overview

So browsers split the URL at the "#".

You'll need to encode the "#" as "%23"

You need to use String.Replace:

Dim outputURL As String = inputURL.Replace("#", "%23")

or HttpUtility.UrlEncode (only encode the querystring):

Dim outputQueryString As String = HttpUtility.UrlEncode(inputQueryString)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜