1

I have an application and it works like a charm if i don't apply rewrite rule. When i apply a rule (even it gives the same address) pagemethod can not be accessible. I call pagemethod inside the js file. It behaves like refreshing the page and only page_load event fires. Page.IsPostback returns always false.

By the way if it is related, i'm using master page.

Web config, urlrewrite rule

<rewriter>
<rewrite url="~/(.+).aspx" to="~/Forms/$1.aspx" />
</rewriter>

Http Modules

  <httpModules>
  <add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>

Js function that trys to reach the pagemethods

<script>
PageMethods.displayPages(a, CallSuccess, CallFailed);
</script>

PageMethod

 [System.Web.Services.WebMethod]
public static string displayPages(string a)
{
    response.write(a);
}

These are what i tried and did not work:

1- Added Pagemethods.set_path("/forms/Default.aspx"); to the Js

2- Added same rule to the web.config like (Even doesn't work like that)

<rewriter>
<rewrite url="~/Forms/(.+).aspx" to="~/Forms/$1.aspx" />
</rewriter>

3- Added the code under master page's Page_load

form1.Action = Context.Request.RawUrl;

Any suggestion would be great. Thank you for your helps.

  • Check out the answer to this question and see if it helps you: http://stackoverflow.com/questions/4321240/pagemethod-and-url-rewrite – User Nov 29 '12 at 22:07

0 Answers0