Welcome to MSDN Blogs Sign in | Join | Help
URL Rewrite for IIS 7.0 / Regular Expressions and Wildcards

Last week we shipped the first preview of URL Rewrite Module for IIS 7.0. If you are not familiar with URL Rewriting engines, please check out the walkthroughs:

 http://learn.iis.net/page.aspx/460/using-url-rewrite-module/.

If you are you familiar with mod_rewrite, I’m pleased to let you know that we have a mod_rewrite rule importer feature to help you to leverage your rule-crafting knowledge:

 http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/

URL Rewrite Module ships two matching engines, one for Regular Expressions (Perl 5 compatible/ECMAScript) and a simple one for wildcard matching. You can choose the engine you feel more comfortable with, I just want to give you some facts (some of them are silly but they are just a reminder):

1.       Regex matching is more powerful, but expensive in terms of execution time.

2.       Wildcard matching is cheaper than Regex and easy to understand.

3.       Both engines are case-insensitive by default.

4.       Case-sensitive matching has much better performance than case-insensitive.

5.       Wildcard matching assumes “exact match”. For an expression like “blog”, it would match “blog” and only “blog”.

6.       Regex matching assumes “partial match”. In this case, “blog” will match “blogger”, “demo/blog”. If you want an exact match you need to change the match expression to “^blog$”.

7.       In Regex, “.” is reserved, it means “any character”, so “default.aspx$” will match “defaultXaspx” too. Escape it to “default\.aspx$’. Wildcards doesn’t have this behavior, the only reserved character is ‘*’.

8.       To create a capture in Regex, use parenthesis.

9.       Each ‘*’ in a wildcard expression creates a capture. For example, an expression like “*.*” would match “logo.jpg” and it will create 2 captures, “logo” and “jpg” (without the dot).

10.   You can reference a capture by index. The index is 1-based, so in the previous example 1 means “logo” and 2 means “jpg”.

11.   The index 0 means “the entire input”. In the previous example 0 means “logo.jpg”.

12.   The syntax for back-reference a capture is {type:index} where type can be R for “Rule Back References” and “ C for “Condition Back References”. The index must be and integer equals or greater than zero.

Please give all the feedback you want, this is a technical preview so your feedback can definitely make a difference for the next release.

Install it from:

Microsoft URL Rewrite Module for IIS 7.0 CTP1 (x86)

Microsoft URL Rewrite Module for IIS 7.0 CTP1 (x64)

URL Rewrite Forum:

http://forums.iis.net/1152.aspx

 

How to find a process command-line using kernel debugger?

 

I hadn't posted since two years ago; a lot of things happen in such a time and now I'm part of the IIS team. I'm not sure about what to talk about, so I will start with random stuff.

I found debugging very task oriented, there are a bunch of ways to get an answer to the same question; let's say that someone gave you a machine ready to be debugged in kernel mode and you want to do .tlist -v to list all the processes and the additional information such as PID, Session, Command Line. If you are using a remote machine to access the target machine in kernel mode, .tlist will give you the process in the remote machine; to get the processes in the target machine and dump process information such as the Command Line arguments follow the next steps:

1. List the processes.

kd> !process 0 0

**** NT ACTIVE PROCESS DUMP ****
PROCESS 8447b790  SessionId: none  Cid: 0004    Peb: 00000000  ParentCid: 0000
    DirBase: 00122000  ObjectTable: 830002d8  HandleCount: 580.
    Image: System

... (some other processes)

PROCESS 867b7d90  SessionId: 0  Cid: 07a4    Peb: 7ffdf000  ParentCid: 0a00
    DirBase: 7ea6b560  ObjectTable: 83170470  HandleCount:  60.
    Image: appcmd.exe

2. Look for your process and copy the DirBase property, in this example I will use appcmd.exe (7ea6b560), and switch to the process' context:

kd> .context 7ea6b560

3. Dump the process information, that information includes the command-line

kd> !peb

PEB at 7ffdf000
    InheritedAddressSpace:    No
    ReadImageFileExecOptions: No
    BeingDebugged:            No

.... (more information)

    ImageFile:    'D:\Windows\System32\inetsrv\appcmd.exe'
    CommandLine:  'D:\Windows\System32\inetsrv\appcmd.exe clear config -section:system.web
Server/cgi'

Introduction

Hi there!, I'm a development consultant at MS Mexico. I'd been bloging at http://danielvl.blogspot.com and now it's time to move to this new home :)

I'm going to share whatever I have learned from the CLR,  design and some Servers (e.g. BizTalk). Currently, I am working in a earlier implementation of WS-RM and there has been a lot of fun :), I'm going to share some C#/C++ code and tools that hope you migh found useful!

Page view tracker