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
'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