Intelligencia.UrlRewriter

I am using Intelligence UrlRewriter for a project.

It works great to rewrite URLs entered into the browser.

For example, if I enter

http://localhost/People

      

This is correctly rewritten as:

http://localhost/People.aspx

      

Now the problem is that when I'm in the code I need to access the friendly url, but Request.ServerVariables only seems to have the unfriendly url.

Does anyone know if anyway I can access this original, friendly url in code? Or am I too late?

0


a source to share


4 answers


Got this guys.

@Nick Allen and Pure.Krome: Thanks for the help!

I found a piece of data in:



HttpContext.Current.Request.RawUrl

      

If it exists in ServerVariables I couldn't see it, but in conclusion, the data is there, so I don't have to cry to sleep :)

Okay. Thanks again!!

+2


a source


Request.PathInfo
Request.QueryString

      



Which one you use depends on whether you are rewriting default.aspx?myvar

ordefault.aspx/myvar

+1


a source


I have been using it and have been for .. er .. 2 years now I think. (Thanks to gawd IIS7 and MVC here!)

anyway, you can check the IIS Server Variables for all of them and tell us what you get ...

  • PATH_INFO
  • Url
  • SCRIPT_NAME

for example (this is the PATH_INFO snippet for a page I set that dumps ALL request variables): -

PATH_INFO: [/admin/Miscellaneous.aspx]

and get it.

Request.ServerVariables["PATH_INFO"]

      

Keep us updated.

0


a source


Intelligencia rewrite rules are stored in the web.config file, which is legible. This way you can traverse the rules in your web.config file to find a match and use the matched value from there

Obviously it wouldn't work for pattern matching, only explicit rules like the one in your example

0


a source







All Articles