S
Steven Nagy
Hi all,
I have the following file:
~/cms/page.aspx
Normally, if you hit a url like http://localhost/MyApp/cms/page.aspx?PageID=32
... this would load content dynamically. No big deal, this is common
right?
So now I want to do some URL rewritting. I want to map:
http://localhost/MyApp/Test.aspx
to
http://localhost/MyApp/cms/page.aspx?PageID=32
(important to note that these are not in the same virtual folder)
So in "global.asax.cs" I write some code in "Application_BeginRequest"
to check if "Test.aspx" was requested, and if it was, rewrite it as
"cms/page.aspx?PageID=32". This also works fine.
The problem I am finding is that the page gets written with form tags
with action="page.aspx?PageID=32"
This of course is running under root so when it POSTS BACK, it
requests:
http://localhost/MyApp/page.aspx?PageID=32
not
http://localhost/MyApp/cms/page.aspx?PageID=32
... and I get an exception (resource not found).
So how can I make the form still use the original "fake" URL
(test.aspx) which would rewrite again on the post back and get the
real file?
Or is there another solution?
Thanks,
Steven
I have the following file:
~/cms/page.aspx
Normally, if you hit a url like http://localhost/MyApp/cms/page.aspx?PageID=32
... this would load content dynamically. No big deal, this is common
right?
So now I want to do some URL rewritting. I want to map:
http://localhost/MyApp/Test.aspx
to
http://localhost/MyApp/cms/page.aspx?PageID=32
(important to note that these are not in the same virtual folder)
So in "global.asax.cs" I write some code in "Application_BeginRequest"
to check if "Test.aspx" was requested, and if it was, rewrite it as
"cms/page.aspx?PageID=32". This also works fine.
The problem I am finding is that the page gets written with form tags
with action="page.aspx?PageID=32"
This of course is running under root so when it POSTS BACK, it
requests:
http://localhost/MyApp/page.aspx?PageID=32
not
http://localhost/MyApp/cms/page.aspx?PageID=32
... and I get an exception (resource not found).
So how can I make the form still use the original "fake" URL
(test.aspx) which would rewrite again on the post back and get the
real file?
Or is there another solution?
Thanks,
Steven