ultraweaver

going beyond the basics

WebResource.axd and ScriptResource.axd 404 error with WordPress

10 Comments

While working on a WordPress project, one of the requirements was to keep an existing web application in ASP.NET which also meant that this would be on a Windows server. No big whoop, right? Here is something I learned…

The rewrite rules for WordPress in the web.config can interfere with calling the WebResource.axd and ScriptResource.axd. The problem is they show up as 404 errors when called via the ASP.NET app.

The fix was to modify the rewrite rules as follows…

The difference is changing the patternSyntax from WildCard to ECMAScript and adding the pattern for .axd.

  • SirG

    Hi, this is the only post I could find of this issue, I’m in the same boat, have to keep an asp.net site running with wordpress. I’m using wordpress 3.3.1 and I’m noticing the wordpress rewrite rules are messing with the .net app being able to find the WebResource.axd on my site. The following link which is created dynamically in my .net app returns a 404 when I have the wordpress rewrite rules active.


    WebResource.axd?d=PQkxjE-M5Qm8oTdmrs5VXIbiMce3MiBo9wMIzWEesTaF-Gd5-WllTvIrt8AJ3rl9vgtmGFYSEfaNkXlf1ND8mHEI9jM1&t=634604821351482412

    I think the wordpress rewrite rules have changed since your post (please see mine below). I’m guessing I need to edit wordpress rule 4. I tried adding the below to wordpress rule 4 , but no luck.

    Thanks very much for any help!!

    • http://www.ultraweaver.com Joey

      The issue for me was also on WP 3.3.1. The above code snippet is what worked for me. Replacing your rewrite riles in the web.config with the above did not work? What do you have for your rules?

  • SirG

    for some reason my post was stripped of the rules, my rules are slightly different to yours, I will try again :)

    • http://www.ultraweaver.com Joey

      Not sure whats up yet… but you can use pre tags instead of code tags.

  • SirG

    how do you post code here? the using the “code” tag does not work for me

  • SirG

    I have 7 wordpress rewrite rules, I have also asked for help on the IIS forum, here is a link to my post there:

    http://forums.iis.net/p/1172016/2016922.aspx#2016922

    it’s the last post on the page (sirg)

    Thanks!

  • http://www.ultraweaver.com Joey

    If you have not tried… try removing what you have for 4 and replace with what I have and see where that gets ya.

  • SirG

    Thanks, I’ll give it a try tomorrow and let you know how it goes :-) The only thing I think might not work is the

    because the url does not end with .axd , it is for example :
    WebResource.axd?d=PQkxjE-M5Qm8oTdmrs5VXIbiMce3MiBo9wMIzWEesTaF-Gd5-WllTvIrt8AJ3rl9vgtmGFYSEfaNkXlf1ND8mHEI9jM1&t=634604821351482412

    but I will try! :-)

  • SirG

    oh well, pre tag doesn’t work for me here either! :-/ I meant the part : pattern=”\.axd$”

  • SirG

    I have now solved this. So for anyone wanting to run wordpress 3.3.1 multisite with an asp.net site together you just need to add the following to wordpress rewrite rule 4.

    so the resulting rewrite rule looks like this: