404 in urlredirection of js files

Discussion in 'ASP.NET 2.0' started by MrDoe, Aug 27, 2010.

  1. Hello,

    I am trying to develop a widget in my site, in order other sites can use it. It seems a javascript file, something like this:

    Code:
    <script type="text/javascript" src="http://www.mysite.com/widget/13/black.js"></script>
    Obviusly that file does not exist, I catch the request with a IHttpModule and I redirect it to a IHttpHandler that responses "text/javascript" using the values "13" and "black" as parameters to build the javascript string.

    It works great in my local machine.

    But in the server I get a 404 error before I can manage the request in the IHttpModule.

    The support team of discount asp.net offered me to map .js files to be handled by asp.net engine for this web application. The problem was that none of the javascripts were able to be downloaded, included the static ones. Despite in my local machine all the requests (also the javascript files) are catched in the IHttpModule and working properly.

    I know it will work if I use the aspx extension, but it can be confusing for my users (developers too). Something like this:

    Code:
    <script type="text/javascript" src="http://www.mysite.com/widget/13/black.aspx"></script>
    So what can I do?
     

Share This Page