ASP.NET Validation stops working when using HTTP Compression?

Last post 04-30-2008 1:05 PM by shikhar. 4 replies.

Sort Posts:

  • ASP.NET Validation stops working when using HTTP Compression?

    04-30-2008, 7:36 AM
    • Loading...
    • shikhar
    • Joined on 12-06-2006, 6:31 AM
    • India/Indore
    • Posts 32

     Hi I am using HTTP Compression( GZip and deflate). Its works fine with static pages. But I am facing issue on those pages which have asp.net validation. My validation dosn't work.
    Can any one help me out here.

    Thanks
    Shikhar

    www.shikhar.net

     

    Shikhar
    www.shikhar.net
  • Re: ASP.NET Validation stops working when using HTTP Compression?

    04-30-2008, 8:24 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,244

    problem is WebResource.axd

    u should exclude that from web.config via

    <excludedPaths>
    <add path="WebResource.axd"/>
    </excludedPaths>

    For detail look at http://blogs.x2line.com/al/archive/2005/12/03/1351.aspx 

    Kamran Shahid(MCSD.NET)
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com
    Microsoft Gold Certified Partner


    Please remember to click "Mark as Answer" on the post that helps you
  • Re: ASP.NET Validation stops working when using HTTP Compression?

    04-30-2008, 8:38 AM
    • Loading...
    • shikhar
    • Joined on 12-06-2006, 6:31 AM
    • India/Indore
    • Posts 32

    Thanks,  but  can you please tell me  where to write this code in web.config. Because I am writing it in <system.web> and it through me an error. I am not using blowery code. 

     

    Thanks

    Shikhar Dadhich

    www.shikhar.net 

    Shikhar
    www.shikhar.net
  • Re: ASP.NET Validation stops working when using HTTP Compression?

    04-30-2008, 9:19 AM
    Answer
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,244
    Kamran Shahid(MCSD.NET)
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com
    Microsoft Gold Certified Partner


    Please remember to click "Mark as Answer" on the post that helps you
  • Re: ASP.NET Validation stops working when using HTTP Compression?

    04-30-2008, 1:05 PM
    Answer
    • Loading...
    • shikhar
    • Joined on 12-06-2006, 6:31 AM
    • India/Indore
    • Posts 32

    Thanks again !

    But both URL using third party dll. The first one using "blowery" in which <httpCompress> is used,  and second link uses "DC" control. 

    I haven't found any way to exclude "WebResource.axd" from web.config.

    Is there any way that we can use HTTPCompression in ASP.NET.

    Here is my code written on Global.asax:

    void Application_BeginRequest(object sender, EventArgs e)
        {

            try
            {
               
                HttpApplication app = (HttpApplication)sender;
                string acceptEncoding = app.Request.Headers["Accept-Encoding"];
               System.IO.Stream prevUncompressedStream = app.Response.Filter;
              
                   if (acceptEncoding == null || acceptEncoding.Length == 0)
                    return;

                acceptEncoding = acceptEncoding.ToLower();

                if (acceptEncoding.Contains("gzip"))
                {
                    // gzip
                    app.Response.Filter = new GZipStream(prevUncompressedStream, CompressionMode.Compress);
                    app.Response.AppendHeader("Content-Encoding",
                        "gzip");

                }
                else
                if (acceptEncoding.Contains("deflate"))
                {
                    // defalte
                    app.Response.Filter = new DeflateStream(prevUncompressedStream, CompressionMode.Compress);
                    app.Response.AppendHeader("Content-Encoding",
                        "deflate");
                }
            }
            catch (Exception ex)
            {
                //Do Nothing .. on Exception
            }
        }

    Thanks

    Shikhar Dadhihc   

    www.shikhar.net 


     

    Shikhar
    www.shikhar.net
Page 1 of 1 (5 items)