49 posts found

Command chaining

Even if you're still stuck using a non-dynamic language (Java, C#, etc), you can steal a trick or two from the other side. Command chaining is an easy practice that can really simplify your code. It's easy.

Read more...

Regular expressions are mandatory

I admit that regular expressions (regexes) are intimidating. I avoided them like a disease for six years. I wasn't quite sure what they did, but seeing stuff like this was enough to make me lose interest quick: <(?[\\w:-]+)(?\\s+(?\\w[-\\w:]*) (\\s*=\\s*\"(?[^\"]*)\"| \\s*=\\s*'(?[^']*)'| \\s*=\\s*(?<%#.*?%>)| \\s*=\\s*(?[^\\s=/>]*)| (?\\s*?)))* \\s*(?)(?:(?/>)|> (?s:(?.*?) (?i:\\s*>))) Whenever I did string parsing, I usually ended up with masses of loops and indexOf calls.

Read more...

Types of ASP.NET paths

ASP.NET is primarily concerned with "virtual paths", the portion of the path following the hostname or port number. When working with ASP.NET, you must understand the following types of URIs thoroughly, and know how they are handled by ASP.NET and the browser.

Read more...

Using a custom VirtualPathProvider can cause OutOfMemoryExceptions

Virtual path providers are awesome - you can serve a site from a .zip file, perform XSLT transformations to generate .aspx files as the compiler reads them, and do all sorts of unusual things. However, using them can make the StaticFileHandler buffer entire downloads in memory before sending the data to the client.

Read more...

The Query String

The query string is handled differently from the rest of the virtual path. It is neither URL decoded or case-normalized before it reaches ASP.NET, although each name-value pair is URL decoded before being stored in the Request.QueryString collection.

Read more...

PathInfo Woes

ASP.NET introduces a new URI component to the equation: PathInfo. It's not very well known, possibly due to poor implementation and consequent lack of usefulness. However, it is important that you understand how it can affect you.

Read more...

Incoming request paths

Casing and URL encoding add significant complexity to the jobs IIS and ASP.NET must perform. ASP.NET automatically decodes and lowercases the scheme, host, and port. The Path (and PathInfo) portions are decoded, but case is not changed.

Read more...