2014-10-14 1 views
0

IHTTPModule을 사용하여 사용자 정의 URL 재 작성을 수행했지만 Response.redirect 패널이 업데이트되었습니다. 사용자 정의 URL 재 작성으로 인해 UpdatePanel 응답 재 지정

는 좀 더 시간을 봤하지만 솔루션이

form1.Action = Request.RawUrl; 

및 웹 설정에 ScriptModule을 추가 할 것입니다 가지고 있지만 이들은 내 경우에는 작동하지 않습니다 해결하지만, 밖으로 업데이트 패널을 모두 잘

노력하고 있습니다 내 재 작성 코드가 아래와 같습니다.

public void Init(HttpApplication context) 
{ 
    context.BeginRequest += (s, e) => 
    { 
     var Application = s as 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"); 
      } 
     } 
    }; 
} 

답변

0

form1.Action = Request.RawUrl; 또한 Ruslan Yakushev (http://www.iis.net/learn/extensions/url-rewrite-module/url-rewriting-for-aspnet-web-forms#Form_postback_URL)의 제안에 따라 web.config에 다음 행을 추가해야합니다.

"conditions"태그의 ".axd"행에 유의하십시오.

<rule name="RewriteUserFriendlyURL1" stopProcessing="true"> 
    <match url="^([^/]+)/?$" /> 
    <conditions> 
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
    <!-- The following condition prevents rule from rewriting requests to .axd files --> 
    <add input="{URL}" negate="true" pattern="\.axd$" /> 
    </conditions> 
    <action type="Rewrite" url="article.aspx?p={R:1}" /> 
</rule> 
관련 문제