RewritePath - Folder To a Query (How To?)

T

Tomasz J

Hello Developers,

I am trying to write a code inside BeginRequest event handler which would
rewrite the following path:
/myapp/user123
to:
/myapp/?user=user123
One requirement:
rewriting path *I do NOT want to specify any particular page*, and allow
ASP.Net to use the default one.

Is it doable? No matter what I try I keep getting "resource not found".

Can it be accomplished with HttpContext.RewritePath? May be I should use
some other method instead?

Thank you for any pointers.

Tomasz J
 
A

Anthony Jones

Tomasz J said:
Hello Developers,

I am trying to write a code inside BeginRequest event handler which would
rewrite the following path:
/myapp/user123
to:
/myapp/?user=user123

This is an important requirement because?
Is it doable?

Possibly, but you've already implied that whatever the default document is
it should be script.
No matter what I try I keep getting "resource not found".

IIS will not be inserting the various document names into the string for you
in this case.
Can it be accomplished with HttpContext.RewritePath?

Only be manually determining what the file name should be, ugly.
May be I should use some other method instead?

Yes assume default.aspx or some other fixed name.
 
S

Steven Cheng[MSFT]

Thanks for Anthony's input.

Hi Tomasz,

For ASP.NET runtime, it can not handle those requests that hasn't a
document extension(all the requestes should end with a document extension).
That's why you always get "resouce not found error". If you do need to
intercept all the requests(include the folder path requests), you may
consider using raw IIS ISAPI filter.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
T

Tomasz J

I understand. After all it is for IIS to request the default page, not
ASP.Net

That leaves me with Response.Redirect(), but I just hate to impose this
additional round-trip.

Thank you.

Tomasz J
 

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

Members online

Forum statistics

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

Latest Threads

Top