What does %5B and %5D in POST requests stand for?

As per this answer over here: str=”foo%20%5B12%5D” encodes foo [12]: %20 is space %22 is quotes %5B is ‘[‘ and %5D is ‘]’ This is called percent encoding and is used in encoding special characters in the url parameter values. EDIT By the way as I was reading https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI#Description, it just occurred to me why … Read more

How to know if an HTTP request header value exists

if (Request.Headers[“XYZComponent”].Count() > 0) … will attempted to count the number of characters in the returned string, but if the header doesn’t exist it will return NULL, hence why it’s throwing an exception. Your second example effectively does the same thing, it will search through the collection of Headers and return NULL if it doesn’t … Read more

Login to the page with HttpWebRequest

Make a new default.aspx, and put this in the code behind: I cant test any further based on your current question, because you didn’t include a valid username/password. using System; using System.Web; using System.Net; using System.IO; using System.Web.UI; using System.Web.UI.WebControls; namespace Foo { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs … Read more

How to send a referer request in a url for a webView

For which API-level do you need that function? Since API Level 8 there is a second loadUrl function: public void loadUrl (String url, Map<String, String> extraHeaders) With the extraHeaders you should be able to send a referrer. EDIT: Here is a complete working example: String url = “http://www.targetserver.tld/”; Map<String, String> extraHeaders = new HashMap<String, String>(); … Read more

How does url rewrite works?

There are two types of behaviour. One is rewrite, the other is redirect. Rewrite The server performs the substitution for itself, making a URL like http://example.org/my/beatuful/page be understood as http://example.org/index.php?page=my-beautiful-page With rewrite, the client does not see anything and redirection is internal only. No URL changes in the browser, just the server understands it differently. … Read more

Why does HttpWebRequest throw an exception instead returning HttpStatusCode.NotFound?

Ya this can be quite annoying when web pages use status codes heavily and not all of them are errors. Which can make processing the body quite a pain. Personally I use this extension method for getting the response. public static class HttpWebResponseExt { public static HttpWebResponse GetResponseNoException(this HttpWebRequest req) { try { return (HttpWebResponse)req.GetResponse(); … Read more

HttpWebRequests sends parameterless URI in Authorization header

It turns out that Digest authentication is fairly easy to implement. With our own implementation, we were able to use the full URI (including parameters) to generate the MD5 hash. That fixed the problem. In case someone hits this problem in the future, you can call the workaround like: var resultText = DigestAuthFixer.GrabResponse(“/dir/index.html”); The code … Read more