RE: RewritePath and Postbacks

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steven Cheng[MSFT] (v-schang_at_online.microsoft.com)
Date: 06/09/04


Date: Wed, 09 Jun 2004 11:44:21 GMT

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