How do I turn off viewstate for good?

后端 未结 6 2094
眼角桃花
眼角桃花 2020-12-29 08:35

Coming from a PHP background I love using clean URLs to grab data from one service to another.

However, on some of my ASP.NET projects I get the horrible ViewState p

6条回答
  •  囚心锁ツ
    2020-12-29 08:44

    Turn off the ViewState by default by using a element in the web.config. Using EnableViewState="true" in the @Page directive will no longer work once you disable the ViewState in the web.config. If you decide later that you need the ViewState for a specific page, you can turn it back on for just that page using a element.

    
      
        
      
    
      
        
          
        
      
      
        
          
        
      
    
    

    You need to do the same for any master pages that your ViewState enabled page uses.

提交回复
热议问题