I have a site that external sites are linking to with a campaign ID
http://www.example.com?cid=123
or (with a slash)
In the case where you miss off the slash most browsers will go and add it in for you. So in either case, whichever you enter the URL that my application is hit is the second URL above. The QueryString parameter is always available.
I was noticing with ASP.NET MVC routing (maybe even without) that when I'm using a virtual directory I don't get this same behavior.
For instance if I have 'http://www.example.com/virtualdirectory?cid=123'
, this will reach my 'default.aspx
' page (since it doesn't match any route). BUT when I examine the value of Request.QueryString
it is blank. If I go to 'http://www.example.com/virtualdirectory?cid=123'
, then the QueryString
value is present in the Request
object.
If I put a breakpoint in Default.aspx.cs
in a newly created MVC project (RTM version of MVC 1.0 - March 2009) then I won't see any query parameters.
i was wondering if there is any way of getting access to these parameters in IIS6 and/or IIS7 if the user accesses a virtual directory by means of a URL like /virtualdirectory?cid=123
.
There may be no solution - but I'm jsut glad I spotted this before linking any partners into a virtual directory!