RewritePath and Postbacks

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

In a portal like application I'm using rewritepath to change from fake
friendly urls back to a central "default" page that actually serves all of
the urls. It works quite well, except... if the page has controls which
cause postback the "default" url is displayed. This makes sense looking at
the form's action which = "default.aspx" and not the fake url. So my
quesiton is, is there a way to maintain the fake url even on postbacks?

Thanks


Brad
 
Not familiar with this but perhaps by using RewritePath again to restore the
friendly name (never used URL rewriting but I belive I saw this in article)
??? Let us know.

Patrice
 
Hi Brad,

From your description, you're using UrlReWrite in ASP.NET web application
and found that when the page is posted back , the browser's address bar
will display the actual underlying url rather than the fake url. So you're
wondering
how to avoid this, yes?

Based on my research, this is a normal behavior of when we using
UrlRewriting for some web page which perform post back. Because the page's
<form > tag has a "action" attribute which is specified the actual url. And
the Buildin System.Web.UI.HtmlControls.HtmlForm doesn't provide any means
to change the action or prevent the action from being redner. However,
there is a way to workaround this, we can define a custom Form class which
derive from the
System.Web.UI.HtmlControls.HtmlForm and override the RenderAttribute method
so as to remove the "action" attribute. The following tech article in MSDN
has mentioned this way in the "Postback handling" section:

#URL Rewriting in ASP.NET
http://msdn.microsoft.com/library/en-us/dnaspp/html/urlrewriting.asp?frame=t
rue

Please have a look. Hope it helps. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top