Thursday 15 March 2012

asp.net - Custom URL Rewriting causing UpdatePanel Response Redirecting -



asp.net - Custom URL Rewriting causing UpdatePanel Response Redirecting -

i have done custom url rewriting using ihttpmodule, cause update panel response.redirect.

i googled more times got solution is

form1.action = request.rawurl;

and add together scriptmodule in web config these prepare not working in case, out update panel working fine

my rewriting code below

public void init(httpapplication context) { context.beginrequest += (s, e) => { var application = s httpapplication; var physicalpath = application.request.physicalpath; if (!file.exists(physicalpath) && !path.hasextension(physicalpath)) { var argstring = application.request.rawurl.replace("\\", "/").trimstart('/'); if (!string.isnullorempty(argstring)) { application.context.rewritepath("/default3.aspx"); } else { application.context.rewritepath("/default2.aspx"); } } }; }

besides form1.action = request.rawurl; should add together next line in web.config suggested ruslan yakushev (http://www.iis.net/learn/extensions/url-rewrite-module/url-rewriting-for-aspnet-web-forms#form_postback_url).

note ".axd" line in "conditions" tag.

<rule name="rewriteuserfriendlyurl1" stopprocessing="true"> <match url="^([^/]+)/?$" /> <conditions> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> <!-- next status prevents rule rewriting requests .axd files --> <add input="{url}" negate="true" pattern="\.axd$" /> </conditions> <action type="rewrite" url="article.aspx?p={r:1}" /> </rule>

asp.net

No comments:

Post a Comment