[CLOSED] WebResource.axd being used for CSS instead of ext.axd

  1. #1

    [CLOSED] WebResource.axd being used for CSS instead of ext.axd

    We have multiple servers that our site is deployed to.

    On most of the servers the js and image files correctly render using ext.axd

    On 2 servers the js files correctly render using ext.axd BUT the <%WebResource for the images are rendering using WebResource.axd instead.

    The code base and web.config is the same on all servers.

    I have included images of what fiddler returns on a working server and a non working server.

    Why do the js files correctly render as ext.axd but the css <%WebResource are rendering as WebResource.axd?

    I have tried IE7, IE8, Google, Firefox

    VS 2010

    .Net 3.5 sp1

    This went to production this weekend and we have not found a resolution yet. I am hoping this will be one of your quick and easy answers!

    Thank You~
    Attached Thumbnails Click image for larger version. 

Name:	WebResource issue - Working.png 
Views:	232 
Size:	5.1 KB 
ID:	2722   Click image for larger version. 

Name:	WebResource issue - Non Working.png 
Views:	241 
Size:	8.1 KB 
ID:	2723  
    Last edited by Daniil; May 19, 2011 at 1:51 PM. Reason: [CLOSED]
  2. #2
    Hi,

    1. I see 302 response (it is mean redirect by server)
    2. Urls from second screenshot is very strange, Ext.Net should never generates such urls

    Do you have public access to the application with problem urls?
    Also, can you post generated urls (rendred urls from html)?
  3. #3
    What is the general support email and I can send you public access URL to the 2 different servers so you can see using fiddler both a working server and non working server.

    Thank You~
  4. #4
    Hi,

    Please send to 'support@object.net'.
    Last edited by geoffrey.mcgill; May 17, 2011 at 7:21 PM.
  5. #5
    Hi,

    I investigate the page and i see that urls are generated correctly but Ext.Net resource handler (ext.axd) build 302 response always (redirect to WebResource.axd)
    It can be in two cases:
    - browser doesn't support compressing or in the web.config you set gzip="false" (on my side browser supports compressing)
    - exception is threw during resource extracting and links parsing

    To understand the problem it is required to debug ResourceHandler on your server (i understand that it is impossible) therefore can you modify ResourceHandler in your repository, rebuild assemblies and copy it to the problem server
    It is required to add StatusDescription to understand the redirect reason
    - need to edit ProcessRequest method in the ResourceHandler class (Ext.Net\Core\ResourceHandler.cs)
    - in that method need to add StatusDescription to 'else'
    if (CompressionUtils.IsGZipSupported && this.sm.GZip)
    {
       ...
    }
    else
    {
            context.Response.StatusDescription = "GZip is not supported";  // <- this line is added
            this.context.Response.Redirect(Page.ClientScript.GetWebResourceUrl(this.sm.GetType(), this.webResource));
    }
    - and add status description to 'catch' block in that 'if'
    catch(Exception e)
                        {
                            string s = e.ToString();
                            context.Response.StatusDescription = s.Substring(0,  Math.Min(s.Length, 512)); // <- this line is added
                            this.context.Response.Redirect(Page.ClientScript.GetWebResourceUrl(this.sm.GetType(), this.webResource));
                        }
    So, if you use lates code from SVN than ProcessRequest must be the same as
    public override void ProcessRequest(HttpContext context)
            {
                this.context = context;
                
                string file = this.context.Request.RawUrl;
    
                bool isInitScript = file.Contains("extnet/extnet-init-js/ext.axd?");
    
                if (!ResourceHandler.IsSourceModified(context.Request) && !isInitScript)
                {
                    context.Response.SuppressContent = true;
                    context.Response.StatusCode = 304;
                    context.Response.StatusDescription = "Not Modified";
                    context.Response.AddHeader("Content-Length", "0");
                    return;
                }
                
                this.SetResponseCache(context);
    
                if (isInitScript)
                {
                    string key = file.RightOfRightmostOf('?');
    
                    if (key.IsNotEmpty())
                    {
                        try
                        {
                            string script = this.context.Session[key].ToString();
                            this.context.Session.Remove(key);                        
                            CompressionUtils.GZipAndSend(script);
                        }
                        catch (NullReferenceException)
                        {
                            throw new InitializationScriptNotFoundException("The Ext.NET initialization script was not found.");
                        }
                    }
                }
                else
                {
                    this.sm = new ResourceManager();
    
                    this.SetWebResourceName(file);
    
                    if (CompressionUtils.IsGZipSupported && this.sm.GZip)
                    {
                        try
                        {
                            this.stream = this.GetType().Assembly.GetManifestResourceStream(this.webResource);
    
                            switch (this.webResource.RightOfRightmostOf('.'))
                            {
                                case "js":
                                    this.WriteFile("text/javascript");
                                    break;
                                case "css":
                                    this.WriteFile("text/css");
                                    break;
    
                                case "gif":
                                    this.WriteImage("image/gif");
                                    break;
                                case "png":
                                    this.WriteImage("image/png");
                                    break;
                                case "jpg":
                                case "jpeg":
                                    this.WriteImage("image/jpg");
                                    break;
                            }
                        }
                        catch(Exception e)
                        {
                            string s = e.ToString();
                            context.Response.StatusDescription = s.Substring(0,  Math.Min(s.Length, 512));
                            this.context.Response.Redirect(Page.ClientScript.GetWebResourceUrl(this.sm.GetType(), this.webResource));
                        }
                        finally
                        {
                            if (this.stream != null)
                            {
                                this.stream.Close();
                            }
                        }
                    }
                    else
                    {
                        context.Response.StatusDescription = "GZip is not supported";
                        this.context.Response.Redirect(Page.ClientScript.GetWebResourceUrl(this.sm.GetType(), this.webResource));
                    }
                }
            }
    Last edited by Vladimir; May 18, 2011 at 7:47 PM.
  6. #6
    I confirmed that we do not have gzip=false in the web.config

    Thank you for the additional information on how to find the exception being thrown. I will need to wait a few weeks until we finish this dev cycle to implement the suggested code. For now, we will just let the 302s continue. I know it has a performance impact, but it doesn't seem to have an impact on the rendering or functionality.

    When I test it I will let you know what I find. You can mark this one as closed.

    Thank You for your help!

Similar Threads

  1. [CLOSED] Question about WebResource.axd vs Ext.axd
    By anup in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 27, 2012, 9:42 PM
  2. [CLOSED] Invalid Webresource Request
    By betamax in forum 1.x Legacy Premium Help
    Replies: 17
    Last Post: Jun 27, 2012, 6:09 PM
  3. [CLOSED] WebResource.axd instead of ext.axd, v1.0
    By chafikb in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: May 31, 2012, 11:19 AM
  4. Replies: 6
    Last Post: May 07, 2010, 12:11 PM
  5. ... invalid webresource request. at System
    By mirzasa in forum 1.x Help
    Replies: 3
    Last Post: Feb 02, 2010, 12:50 PM

Tags for this Thread

Posting Permissions