RAD Compression - aspx page exception

2 posts, 0 answers
  1. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 04 Aug 2010 Link to this post

    Hi,

    I am using view state compression specified in the below mentioned url. (App_Browsers changes)

    http://www.telerik.com/help/aspnet-ajax/radcompression.html

    <browsers>  
     
    <browser refID="Default">   
       
    <controlAdapters>  
         
    <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadSessionPageStateCompression" />  
       
    </controlAdapters>  
     
    </browser>  
    </browsers>

    I have a aspx page which has "EnableSessionState = false" and "EnableViewState = false" set.

    In this case, when i open the aspx, it is throwing the error "

    SessionPageStatePersister can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.

    "

    Please note that I have no code behind file for my aspx page... how do you give this in aspx page?
    [RadCompressionSettings(HttpCompression = CompressionType.None)]  
    Can I give this page as part of the exception list? Please help.

    Regards,
    Kishan G K
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 10 Aug 2010 Link to this post

    Hello Kishan,

    RadCompressionSettingsAttribute must be applied on class and as you are using single file model you cannot do that.

    However you can inherit RadSessionPageStateCompression in order to overcome this scenario.

    /class file that contains extend RadSessionPageStateCompression/
    namespace CustomSpace
    {
        public class CustomStateCompression : RadSessionPageStateCompression
        {
            public override System.Web.UI.PageStatePersister GetStatePersister()
            {          
                //if page session is disabled - used default bahavior
                if (HttpContext.Current.Session == null)
                    return new HiddenFieldPageStatePersister(base.Page);
                //otherwise compress
                return base.GetStatePersister();
            }
      
        }
    }

    /browser file - utilize custom compressions adapter/
    <browsers>
      <browser refID="Default">
        <controlAdapters>
          <adapter controlType="System.Web.UI.Page" adapterType="CustomSpace.CustomStateCompression" />
        </controlAdapters>
      </browser>
    </browsers>


    Regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top