Anyone have an idea offhand regarding why a link with an "@" in it works on my browser, but when I go to get this particular link in my HttpWebRequest code I get a 405 error?
The remote server returned an error: (405) Method Not Allowed.
The example link in question:
http://internal_link/@api/deki/site/lo开发者_开发问答go.png
thanks
The @ sign is a reserved character in a URL.
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
(See http://www.ietf.org/rfc/rfc2396.txt)
So I'd suggest to escape (something the browser does automatically), using %40
instead of @
.
An http is an http request. The server doesn't care whether it's from a browser or something else. If it rejects one and not the other, it's because you're not sending the same request. Some things to check might be the user agent, cookies, or whether the browser is somehow altering the @ sign in that url before sending it. You can use a program like fiddler to check the request sent by the browser and alter your code to make sure it sends the same request.
精彩评论