Eyl 12 2009

Prevent URL Rewriting of Requests for ASP.NET-WebResources.axd

Category: Ajax | ASP.NETLatif @ 14:50

Hi again,

 WebResources.axd is created by ASP.NET for performing AJAX processes in the page. İn Addition, there is no such file on the web server due to the fact that ASP.NET produce the content dynamically when WebResources.axd is requested.

 

If you want to see the content of WebResources.axd, you have to run it on browser. Script path is in the page source code like below,

 

<script src="/WebResource.axd?d=7OCAQ3R3VOQC0D4ciLQ5OCpSc8_wxlQ0C-KYhGZ-_ag1&amp;t=633566872339565967" type="text/javascript"></script>

 

İf you are using Url Rewring, URL rewrite rule may accidentally make the requests to WebResources.axd and this will break your application.

 

Anyway, in order to prevent URL Rewriting of Requests for ASP.NET Web Resources(.axd) and other type of files such as .xml,.js,.css , you should add rule to web.config.

<rewriter>

     <rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.xml|\.pdf|\.axd|\.css|\.js)(\?.+)?)$" to="$1" processing="stop" />

     <rewrite url="/([0-9]{6})(.*)/(.*)-(.*)" to="~/Detail.aspx?aid=$1" />

 </rewriter>

 

The problem can be easily prevented by this rule.

 

Have a good time...

Tags:

Ağu 14 2009

ASP.Net AJAX Not Working (Full page postback)

Category: Ajax | ASP.NETLatif @ 15:45

 Hi,

After carrying my web application to windows server 2003 R2 from windows  XP - IIS 5.1,  I have encountered a ASP.Net AJAX issue that my page is performing a full page postpage instead of a partial page postback of the expected AJAX page elements.

        I have searched everywhere, and this is the only solution I can find.  I just stumbled upon this page below and I applied what it is saying.  I would like to thank to Neil kilbride for sharing this solution with us.

http://neilkilbride.blogspot.com/2008/01/aspnet-ajax-not-working-full-page.html

Solution :

I just added to my web.config file following code to solve the problem.

   <system.web>

        <xhtmlConformance mode="Transitional" />

  </system.web>

 And also he says thatIf you are having ASP.Net AJAX issues I recommend removing the <xhtmlConformance> section from your web.config file or perhaps set it to Transitional or Strict.

 

Tags: ,