URLs and Paths and stuff

D

David

Hi all,

using ASP.NET 1.1 C#

I am using URL ReWriting to rewrite the URL of the incoming page.

A problem I had was of pages without .aspx extension not mapping, so no
rewriting would work... So, in IIS I set up the 404 to redirect the page to
a 404.aspx handler. This then calls my URL ReWriter.

So, I need to find out the full address in the address bar so that I can map
the page correctly.

rawurl shows the 404 handler page with the address bar page as a parameter.

request.path shows the 404 handler but no parameters.

Is there anything that will give me the URL that I see in the address bar
without the 404 handler?

Thanks.

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
G

Guest

Hi all,

using ASP.NET 1.1 C#

I am using URL ReWriting to rewrite the URL of the incoming page.

A problem I had was of pages without .aspx extension not mapping, so no
rewriting would work... So, in IIS I set up the 404 to redirect the page to
a 404.aspx handler. This then calls my URL ReWriter.

So, I need to find out the full address in the address bar so that I can map
the page correctly.

rawurl shows the 404 handler page with the address bar page as a parameter.

request.path shows the 404 handler but no parameters.

Is there anything that will give me the URL that I see in the address bar
without the 404 handler?

Use Page.Request.Url.AbsoluteUri to get the requested URL in 404.aspx

Regarding working without the 404 handler: IIS hands off incoming
requests to the ASP.NET engine only if the requested file has an
appropriate extension (ASPX). And to make URL like /blabla/product/
working as page.aspx you should either create a directory /blabla/
product/ with default.aspx in it, or you should map all the requests
to ASP.NET engine in IIS.

Please check the following tutorials:

Performing Simple URL Rewriting with the URL Rewriting Engine
http://msdn2.microsoft.com/en-us/library/ms972974.aspx

and this
http://www.codeproject.com/aspnet/URLRewriter.asp
 
D

David

Hi,

Thanks for the response. I will have a look at that... meanwhile, I did get
a working solution by parsing the rawurl when a 404 occured.

Handling the 404 through IIS is not going to be a problem, except possibly
for a postbask. The 404 gets sent to a known .aspx page, and being a .aspx,
the handler works. (The url-rewriter is inside the global.asax.cs).

I have just looked at the codeproject link you posted. That is too much for
my app. Handling it the way I am handling it is actually (I think) much
better. I can handle real non-aspx pages (htm, html etc.) and rewrite
non-real (virtual) pages, including htm, html etc by using the 404 handler.

It all (so far) is working beautifully, though I will probably find some
unwanted 'features'. If you can find potential problems with the way I am
handling it, I would appreciate your comments.

What I must avoid is having to write stuff to the GAC and add ISAPI's etc.

Best regards,
Dave Colliver.
http://www.DerbyFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top