Disable ViewState

Discussion in 'ASP .Net' started by Julien Grossiord, Nov 23, 2005.

  1. Hello,

    As I do not need it, I would like to disable ViewState on my server but even
    if I use <pages enableViewState="false"> in web.config or <%@ Page EnableViewState="false"
    .... %> in my pages, I still have a hidden field __VIEWSTATE in the form.

    Do you know how I could disable it ?

    Best regards,
    Julien.

    NB : I use .Net 1.1 on Win 2
    Julien Grossiord, Nov 23, 2005
    #1
    1. Advertising

  2. Julien Grossiord

    Bruce Barker Guest

    there is no way to remove viewstate, its used by the .net infrastrure. you
    can turn off controls also using it. if you don't need postback support
    (IsPostBack and auto loading of postback data into the controls) you can
    strip viewstate by providing your own IStateManager.


    -- bruce (sqlwork.com)

    "Julien Grossiord" <> wrote in message
    news:...
    > Hello,
    >
    > As I do not need it, I would like to disable ViewState on my server but
    > even if I use <pages enableViewState="false"> in web.config or <%@ Page
    > EnableViewState="false" ... %> in my pages, I still have a hidden field
    > __VIEWSTATE in the form.
    >
    > Do you know how I could disable it ?
    >
    > Best regards,
    > Julien.
    >
    > NB : I use .Net 1.1 on Win 2K
    >
    >
    >
    Bruce Barker, Nov 23, 2005
    #2
    1. Advertising

  3. Julien Grossiord

    emancero

    Joined:
    Nov 12, 2006
    Messages:
    1
    delete runat="server" from form1

    If you are not using asp.net webcontrols that are usually part of a form like textboxes, buttons, etc.. You can delete runat="server" from the asp.net main form, generally the "form1" form, this way the hidden __VIEWSTATE field won't be rendered.

    I have found a situation where you wouldn't want this control rendered: some mail spam detection programs try to make strange changes to hidden fields, so if you e-mail an asp.net generated page, chances are some mail scanner will distort it.
    emancero, Nov 12, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Homa
    Replies:
    2
    Views:
    1,917
  2. Rhodri
    Replies:
    1
    Views:
    382
    Rick Spiewak
    Apr 22, 2004
  3. Stan
    Replies:
    3
    Views:
    10,350
  4. Umut Tezduyar
    Replies:
    4
    Views:
    3,326
    Ravi Ambros Wallau
    Feb 15, 2006
  5. George Ter-Saakov

    disable ViewState ?

    George Ter-Saakov, Oct 17, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    1,084
    Eliyahu Goldin
    Jan 20, 2007
Loading...

Share This Page