Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewstate Too Large - Cause Known, Need Better Solution

Status
Not open for further replies.

grippy

Programmer
Dec 2, 2004
161
US
Hello, I have been trying to figure out why my website is sooo large in file size and it is due to the size of the viewstate. When I remove the following code my page size lower drastically.

'get Description

Try
Dim asr As System.IO.StreamReader
Dim straReadStream As String
asr = New System.IO.StreamReader( _
New System.IO.FileStream(System.AppDomain.CurrentDomain.BaseDirectory() & "descriptions/springs.txt", IO.FileMode.Open), System.Text.Encoding.ASCII)

'read from the stream
straReadStream = asr.ReadToEnd
litDescription.Text = straReadStream
asr.Close()
Catch
End Try

Basically this code pulls up a text file and displays whatever is in that txt file on the ASPX page. I use it to put in HTML but I have found that if I manually put the HTML in the aspx page rather than a text file my viewstate lowers alot. Is there a better way to do this so that I can use my txt file and not have the viewstate get so large? On this particular page the content is static but I have other aspx pages that pull up dynamic descriptions for products and such. Let me know what you guys think. Thanks for the help
 
nevermind I figured out that I can just disable viewstate and it all works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top