locked
HOWTO: webresource.axd ??? RRS feed

  • Question

  • User-1270520852 posted

    could someone help me about how to transfer external file to the client as "webresource.axd"? what i want to transfer is client javascript type of file. I've written the code but all i get is header-only blank-content file transferred as webresource.axd while i checked from microsoft fiddler.

    the code i write :

    1.  a control name "webresource.cs"

     

    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    [assembly: WebResource("Script1.js", "application/x-javascript")]
    namespace Controls
    {
        public class WebResource
        {

        }
    }

    2. the external file "Script1.js" located in the same root as "WebResource.cs", and filled with some code and have the properties set to embedded resource

    3. The web site page "default.aspx.cs" that contains :

             Page.ClientScript.RegisterClientScriptResource(typeof(WebResource),"Script1.js");

     

    In the run time, I check the file transferred from client, i got that file named "WebResource.axd?####" but the content is nothing...

     

     

     

     

    Tuesday, October 3, 2006 12:13 AM

All replies

  • User1590015237 posted
    Have you tried changing the MIME-type from application/x-javascript  to text/javascript? Try requesting the resource using a terminal session to see the exact header output. (Something like telnet www.myserver.com 80 and then typing GET WebResource.axd?#### HTTP/1.0 might do the trick.)
    Wednesday, October 4, 2006 2:30 AM