Page.EnableViewState = false;Disabled it in the @page directives:
<%@ Page language="c#" Codebehind="odds.aspx.cs" AutoEventWireup="false" Inherits="pokerweb.help.odds" EnableViewState="false" EnableSessionState="False"%>...disabled it in the web.config with
...and although small, the viewstate is still there. The only way i've found to completely remove it is to overide the Render method of the page and manually strip the form field out. this seems to work
using System.IO;
protected override void Render( System.Web.UI.HtmlTextWriter writer )
{
// Obtain the HTML rendered by the instance.
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter( sw );
base.Render( hw );
string html = sw.ToString();
hw.Close();
sw.Close();
// Find the viewstate.
int start = html.IndexOf( @" -1 )
{
int end = html.IndexOf( "/>", start ) + 2;
// Strip out the viewstate.
string viewstate = html.Substring( start, end - start );
html = html.Remove( start, end - start );
}
// Send the results back into the writer provided.
writer.Write( html );
}
// Obtain the HTML rendered by the instance.
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter( sw );
base.Render( hw );
string html = sw.ToString();
hw.Close();
sw.Close();
// Find the viewstate.
int start = html.IndexOf( @" -1 )
{
int end = html.IndexOf( "/>", start ) + 2;
// Strip out the viewstate.
string viewstate = html.Substring( start, end - start );
html = html.Remove( start, end - start );
}
// Send the results back into the writer provided.
writer.Write( html );
}