Let say browser sent a request for /mysite/my.aspx
HttpContext.Rewrite kicks in before that aspx processed and rewrites it to
/mysite/template1/notmy.aspx.
From now on the ASP.NET engine will see that request as if came to
/mysite/template1/notmy.aspx pretty much ignoring the original request for
/mysite/my.aspx
You see??? You just rewrote the URL.
The client is unaffected in anyway (ALMOST). Since it thinks that it still
gets the HTML from /mysite/my.aspx
Guess why i have that almost there? I was amazed that practically any
article or sample of using that HttpContext.Rewrite does not mention one
small but important problem
The <form> action will be /mysite/template1/notmy.aspx
So the next time you click submit button you will clearly see in the browser
full url.
Of course there is an easy workaround "In a page_load event rewrite url back
to the original"
Another thing is you must be careful with path you specify to images or js
files.
If you use relative path browser will convert it to full path and send
request to the server. And since browser has no idea that URL was rewritten
it will ask for
/mysite/my.gif not /mysite/template1/my.gif. Which might be not what you
expected.
So it's probably better to specify the full path for images and ohter
related to the page files.
George.
"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:Od*************@TK2MSFTNGP10.phx.gbl...
Can someone explain in layman's term, what HttpContext.RewritePath does?
SDK doc explanation is kind of scant.
Does it only affect the request processing for the duration of the
processing(meaning server side), or is the client in anyway affected?
Thanks