Register | Login
Friday, August 08, 2008

Sections
  
About Us
  
Hosting Provided by Server Intellect
Partners
Downloads
  
 WWWCoder.com Resource Directory

 

ORDER TODAY!
Professional DotNetNuke ASP.NET Portals
Amazon.com now has the only DotNetNuke book you'll ever need. Written by the guys who brought you DotNetNuke, Shaun Walker, Patrick Santry, Joe Brinkman, Dan Caron, Scott McCulloch, Scott Willhite, and Bruce Hopkins. Order it now! .

DNN and ViewState
9/17/2004 7:12:28 AM

Here are some tricks for modifying your DNN install to move the viewstate into a session. There are some give and take issues when doing this, but we cover it in this article.

I'm not a big fan of viewstate, great idea from getting away from sessions, but it really is a pain. MS is doing some enhancements to viewstate in the next version of ASP.NET, but being a DotNetNuke user I wanted to clean my DotNetNuke implementation from the viewstate. I know there are several methods of dealing with viewstate from loading into a file, database or session. For me, memory overhead of storing in a session wasn't as big of an issue so I opted for that.

Moving viewstate into a session is pretty easy to do in DotNetNuke. Since all pages inherit from the DotNetNuke.Basepage class, all you need to do is modify this one class in order to remove the viewstate from your HTML and put it into the session or server's memory. Below is the modification I did in order to do that, another thing you'll notice here is I took out the method that intercepts the request and places the viewstate into the bottom of the HTML form instead of the top. This method was added for spiders, since relevant content is indexed at the top of the HTML page, and considered less relevant when content is towards the end. Since some of the viewstate crypts were hovering around 50k, it was hurting DotNetNuke sites in their rankings. I really don't like the viewstate move method since it processes post-request, basically pulling out the viewstate from the HTML string and inserting it into the bottom of the page. There is plenty of overhead to do this on every request, and since I'm removing the viewstate crypt from the page it isn't necessary to have the method in there. This way I move the overhead onto the hardware which we can always upgrade if needed, and lighten the load on my bandwidth, and make the pages load much faster.

This is a core mod, so if you're going to use it you need to readd it if you upgrade your DotNetNuke install. The basepage.vb file is located in the components directory of the DotNetNuke application.

Imports System

Imports System.Diagnostics

Namespace DotNetNuke

Public Class BasePage

Inherits System.Web.UI.Page

Private _formatter As New LosFormatter

Private Sub Page_Error(ByVal Source As Object, ByVal e As System.EventArgs) Handles MyBase.Error
   Dim exc As Exception = Server.GetLastError
   Dim strURL As String = ApplicationURL()
   If Not Request.QueryString("error") Is Nothing Then
      strURL += "&error=terminate"
   Else
      strURL += "&error=" & Server.UrlEncode(exc.Message)
      If Not IsAdminControl() Then
         strURL += "&content=0"
      End If
   End If
   ProcessPageLoadException(exc, strURL)
End Sub

'save viewstate to a session. in the next two methods we take the viewstate and load/unload into a session variable.

Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As Object)
   Dim Key As String = Request.Url.ToString & "__VIEWSTATE"
   Dim memStream As New System.IO.MemoryStream
   _formatter.Serialize(memStream, viewState)
   memStream.Flush()
   Session(Key) = memStream
End Sub

Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
   Dim Key As String = Request.Url.ToString & "__VIEWSTATE"
   If Not Session(Key) Is Nothing Then
      Dim memStream As System.IO.MemoryStream = CType(Session(Key), System.IO.MemoryStream)
      memStream.Seek(0, IO.SeekOrigin.Begin)
      Return _formatter.Deserialize(memStream)
   End If
End Function

End Class 'BasePage

End Namespace


Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
Left on 5/8/2008 7:33:46 AM by Anonymous
Comments: cool idea
Left on 4/25/2008 2:52:46 PM by Anonymous
Comments: http://www.hothackerclub.com
No ratings available.
Left on 11/12/2007 10:24:59 AM by Anonymous
Comments: JIarXr 34fv0s9kmfdv4mnfv2kkls03
Left on 10/24/2007 11:12:24 PM by Anonymous
Comments: vcJY28 fdbv345n5n6cv97vd9
Left on 10/2/2007 4:15:44 PM by Anonymous
Comments: qMw1Vp 360dfv923bf
Left on 10/1/2007 11:34:10 PM by Anonymous
Comments: Ffv5pA 304fgbmc953czo
Left on 9/3/2007 1:20:27 PM by Anonymous
Comments: somestrangetextvista
Left on 9/1/2007 11:16:27 AM by Anonymous
Comments: teeniefiles http://www.xanga.com/t_jl/612768733/teeniefiles.html teeniefiles teenmodels http://www.xanga.com/t_jl/612768770/teenmodels.html teenmodels teenthumbs http://www.xanga.com/t_jl/612768807/teenthumbs.html teenthumbs tightpussy http://www.xanga.com/t_jl/612768837/tightpussy.html tightpussy
Left on 9/1/2007 10:58:32 AM by Anonymous
Comments: tinypussy http://www.xanga.com/t_jl/612768876/tinypussy.html tinypussy virginpussy http://www.xanga.com/t_jl/612768915/virginpussy.html virginpussy virginsex http://www.xanga.com/t_jl/612768948/virginsex.html virginsex webcammania http://www.xanga.com/t_jl/612769000/webcammania.html webcammania
Left on 9/1/2007 10:55:39 AM by Anonymous
Comments: wetpussy http://www.xanga.com/t_jl/612769029/wetpussy.html wetpussy worldsex http://www.xanga.com/t_jl/612769061/worldsex.html worldsex xxxporn http://www.xanga.com/t_jl/612769091/xxxporn.html xxxporn xxxsex http://www.xanga.com/t_jl/612769121/xxxsex.html xxxsex zoosex http://www.xanga.com/t_jl/612769166/zoosex.html zoosex
Left on 8/31/2007 11:15:29 PM by Anonymous
Comments: realsex http://www.xanga.com/t_jl/612766014/realsex.html realsex selfsuck http://www.xanga.com/t_jl/612766070/selfsuck.html selfsuck sexadelphia http://www.xanga.com/t_jl/612766267/sexadelphia.html sexadelphia
Left on 8/31/2007 11:01:00 PM by Anonymous
Comments: sexmaxx http://www.xanga.com/t_jl/612766736/sexmaxx.html sexmaxx sextoys http://www.xanga.com/t_jl/612766774/sextoys.html sextoys sexxx http://www.xanga.com/t_jl/612766818/sexxx.html sexxx
Left on 8/31/2007 10:48:18 PM by Anonymous
Comments: sexygirls http://www.xanga.com/t_jl/612766866/sexygirls.html sexygirls sexygrannies http://www.xanga.com/t_jl/612766899/sexygrannies.html sexygrannies sexyjobs http://www.xanga.com/t_jl/612766931/sexyjobs.html sexyjobs
Left on 8/31/2007 10:42:04 PM by Anonymous
Comments: sexgaymes http://www.xanga.com/t_jl/612766583/sexgaymes.html sexgaymes sexgrannies http://www.xanga.com/t_jl/612766639/sexgrannies.html sexgrannies sexmaniac http://www.xanga.com/t_jl/612766686/sexmaniac.html sexmaniac
Left on 8/31/2007 4:35:17 PM by Anonymous
Comments: myfirstsexteacher http://www.xanga.com/t_jl/612760576/myfirstsexteacher.html myfirstsexteacher mygaydar http://www.xanga.com/t_jl/612761426/mygaydar.html mygaydar nifty erotic gay archives http://www.xanga.com/t_jl/612761515/gay.html
Left on 8/31/2007 4:18:47 PM by Anonymous
Comments: privatexxx http://www.xanga.com/t_jl/612765896/privatexxx.html privatexxx privatexxx.org http://www.xanga.com/t_jl/612765946/privatexxx.html privatexxx.org realitysexsites http://www.xanga.com/t_jl/612765976/realitysexsites.html realitysexsites
Left on 8/31/2007 4:13:42 PM by Anonymous
Comments: porncity http://www.xanga.com/t_jl/612765740/porncity.html porncity preteensex http://www.xanga.com/t_jl/612765801/preteensex.html preteensex preteenz http://www.xanga.com/t_jl/612765864/preteenz.html preteenz
Left on 8/31/2007 4:12:20 PM by Anonymous
Comments: nudeteenphoto http://www.xanga.com/t_jl/612761596/nudeteenphoto.html nudeteenphoto oldpussy http://www.xanga.com/t_jl/612761662/oldpussy.html oldpussy pictures of hetero handjobs http://www.xanga.com/t_jl/612761725/handjobs.html
Left on 8/31/2007 9:48:41 AM by Anonymous
Comments: lesbianteens http://www.xanga.com/t_jl/612759901/xxx.html lesbianteens livesexlist http://www.xanga.com/t_jl/612759951/xxx.html livesexlist lolitasex http://www.xanga.com/t_jl/612760016/xxx.html lolitasex
Left on 8/31/2007 9:19:59 AM by Anonymous
Comments: maturebitches - wife & babysitters http://www.xanga.com/t_jl/612760272/xxx.html maturehardpics http://www.xanga.com/t_jl/612760311/xxx.html maturehardpics maturemom http://www.xanga.com/t_jl/612760377/xxx.html maturemom
Left on 8/31/2007 9:11:01 AM by Anonymous
Comments: maturepost http://www.xanga.com/t_jl/612760422/xxx.html maturepost momandsonsex http://www.xanga.com/t_jl/612760477/xxx.html momandsonsex monstercocks http://www.xanga.com/t_jl/612760525/xxx.html monstercocks
Left on 8/30/2007 10:49:32 PM by Anonymous
Comments: horsecock http://www.xanga.com/t_jl/612758800/xxx.html horsecock horsesex http://www.xanga.com/t_jl/612758848/xxx.html horsesex hotsex http://www.xanga.com/t_jl/612758990/xxx.html hotsex
Left on 8/30/2007 10:39:58 PM by Anonymous
Comments: hotteens http://www.xanga.com/t_jl/612759048/xxx.html hotteens hotteensex http://www.xanga.com/t_jl/612759113/xxx.html hotteensex hugecocks http://www.xanga.com/t_jl/612759186/xxx.html hugecocks
Left on 8/30/2007 10:26:52 PM by Anonymous
Comments: jay's xxx http://www.xanga.com/t_jl/612759404/xxx.html jay's xxx jjj pornno http://www.xanga.com/t_jl/612759471/xxx.html jjj pornno lesbiandatingnetwork http://www.xanga.com/t_jl/612759851/xxx.html lesbiandatingnetwork
Left on 8/30/2007 4:36:44 PM by Anonymous
Comments: gaypornaccess http://www.xanga.com/t_jl/612755192/gay.html gaypornaccess gaysex http://www.xanga.com/t_jl/612756715/gay.html gaysex
Left on 8/30/2007 4:00:59 PM by Anonymous
Comments: handjob http://www.xanga.com/t_jl/612757835/xxx.html handjob hardcoreporn http://www.xanga.com/t_jl/612757910/xxx.html hardcoreporn
Left on 8/30/2007 3:49:14 PM by Anonymous
Comments: groupsex http://www.xanga.com/t_jl/612757717/xxx.html groupsex hairypussy http://www.xanga.com/t_jl/612757771/xxx.html hairypussy
Left on 8/30/2007 8:40:38 AM by Anonymous
Comments: freewebcam http://www.xanga.com/t_jl/612754480/xxx.html freewebcam freexxx http://www.xanga.com/t_jl/612754604/xxx.html freexxx
Left on 8/30/2007 8:35:32 AM by Anonymous
Comments: freesexpics http://www.xanga.com/t_jl/612754234/xxx.html freesexpics freeteenporn http://www.xanga.com/t_jl/612754396/xxx.html freeteenporn
Left on 8/30/2007 8:17:43 AM by Anonymous
Comments: gayguys http://www.xanga.com/t_jl/612754961/gay.html gayguys gayporn http://www.xanga.com/t_jl/612755043/gay.html gayporn
Left on 8/29/2007 3:58:28 PM by Anonymous
Comments: dragonballxxx http://www.xanga.com/t_jl/612732630/xxx.html dragonballxxx duckyporn http://www.xanga.com/t_jl/612733537/xxx.html duckyporn ebonymale http://www.xanga.com/t_jl/612752421/xxx.html ebonymale
Left on 8/29/2007 3:27:38 PM by Anonymous
Comments: freeporno http://www.xanga.com/t_jl/612753590/xxx.html freeporno freepornpics http://www.xanga.com/t_jl/612753710/xxx.html freepornpics freesex http://www.xanga.com/t_jl/612754098/xxx.html freesex
Left on 8/29/2007 3:26:11 PM by Anonymous
Comments: ebonythumbs http://www.xanga.com/t_jl/612752630/xxx.html ebonythumbs exploitedblackteens http://www.xanga.com/t_jl/612752792/xxx.html exploitedblackteens familyporn http://www.xanga.com/t_jl/612752987/xxx.html familyporn
Left on 8/29/2007 1:28:44 AM by Anonymous
Comments: blackporn http://www.xanga.com/t_jl/612730009/xxx.html blackporn blackpornstars http://www.xanga.com/t_jl/612730174/xxx.html blackpornstars blackpussy http://www.xanga.com/t_jl/612730354/xxx.html blackpussy
Left on 8/29/2007 12:58:16 AM by Anonymous
Comments: cocksuckers http://www.xanga.com/t_jl/612731116/xxx.html cocksuckers cporn.info http://www.xanga.com/t_jl/612731407/xxx.html cporn.info cruisingforsex http://www.xanga.com/t_jl/612731713/xxx.html cruisingforsex
Left on 8/29/2007 12:26:57 AM by Anonymous
Comments: blacksex http://www.xanga.com/t_jl/612730551/xxx.html blacksex cartoonporn http://www.xanga.com/t_jl/612730743/xxx.html cartoonporn childporn http://www.xanga.com/t_jl/612730955/xxx.html childporn
Left on 8/28/2007 6:28:38 PM by Anonymous
Comments: 23sex http://www.xanga.com/t_jl/612726994/xxx.html 23sex 321teenchat http://www.xanga.com/t_jl/612727276/xxx.html 321teenchat 8teen http://www.xanga.com/t_jl/612726615/xxx.html 8teen
Left on 8/28/2007 6:14:49 PM by Anonymous
Comments: animalporn http://www.xanga.com/t_jl/612728224/xxx.html animalporn bigcocks http://www.xanga.com/t_jl/612728425/xxx.html bigcocks bigdick http://www.xanga.com/t_jl/612728672/xxx.html bigdick
Left on 8/28/2007 6:13:03 PM by Anonymous
Comments: bigpussy http://www.xanga.com/t_jl/612729194/xxx.html bigpussy bigtits http://www.xanga.com/t_jl/612729624/xxx.html bigtits blackcockparty http://www.xanga.com/t_jl/612729817/xxx.html blackcockparty
Left on 8/28/2007 5:59:31 PM by Anonymous
Comments: abbeyphonesex http://www.xanga.com/t_jl/612727557/xxx.html abbeyphonesex adultfinder http://www.xanga.com/t_jl/612727760/xxx.html adultfinder adultfriendfinders http://www.xanga.com/t_jl/612728030/xxx.html adultfriendfinders
Left on 8/26/2007 5:46:15 PM by Anonymous
Comments: Hello, see new free porn movies http://www.xanga.com/freeprnmoviesz free porn movies
Left on 8/26/2007 5:08:56 PM by Anonymous
Comments: teen pussy http://www.xanga.com/tpz teen pussy
Left on 8/26/2007 4:32:19 PM by Anonymous
Comments: teen porn http://www.xanga.com/teenprnz teen porn
Left on 8/26/2007 4:27:24 PM by Anonymous
Comments: porn pics http://www.xanga.com/fppz free porn pics
Left on 8/25/2007 4:45:03 PM by Anonymous
Comments: preteenpics
http://www.xanga.com/f_v/612106985/xxx.html http://www.xanga.com/f_v/612107388/xxx.html sexsearch
http://www.xanga.com/f_v/612107471/xxx.html sexual movies porn
Left on 8/25/2007 4:36:51 PM by Anonymous
Comments: sleazy dreams xxx http://www.xanga.com/f_v/612108676/xxx.html teenpics http://www.xanga.com/f_v/612108788/xxx.html teenporn http://www.xanga.com/f_v/612108908/xxx.html teenporn
Left on 8/25/2007 4:17:02 PM by Anonymous
Comments: sexy bikinis http://www.xanga.com/f_v/612107603/xxx.html
sexy grannies http://www.xanga.com/f_v/612108026/xxx.html
sexy moms http://www.xanga.com/f_v/612108174/xxx.html sexy moms
Left on 8/25/2007 10:30:41 AM by Anonymous
Comments: preteengirls http://www.xanga.com/preteenlolitasz/612030220/preteengirls.html preteengirls
Left on 8/25/2007 9:42:33 AM by Anonymous
Comments: preteen pics http://www.xanga.com/preteenlolitasz/612030164/preteen-pics.html preteen pics
Left on 8/25/2007 9:34:36 AM by Anonymous
Comments: preteen lolitas http://www.xanga.com/preteenlolitasz/612030055/preteen-lolitas.html preteen lolitas
Left on 8/25/2007 9:32:26 AM by Anonymous
Comments: porn pic gallaries http://www.xanga.com/preteenlolitasz/612030119/porn-pic-gallaries.html porn pic gallaries
Left on 8/24/2007 9:09:42 AM by Anonymous
Comments: kiddie porn http://www.xanga.com/kiddieprn kiddie porn
kim possible porn http://www.xanga.com/kimpossibleprn kim possible porn
Left on 8/24/2007 8:58:00 AM by Anonymous
Comments: mature escorts http://www.xanga.com/Mature_Escorts mature escorts
naked horny teens http://www.xanga.com/Naked_Horny_Teens horny teens
Left on 8/24/2007 8:21:53 AM by Anonymous
Comments: nakedteenies http://www.xanga.com/nakedteenies nakedteenies
nasty teens http://www.xanga.com/Nasty_Teens nasty teens
Left on 8/23/2007 11:58:38 PM by Anonymous
Comments: free porn pics http://www.xanga.com/freeprnpics porn pics
Left on 8/23/2007 11:29:30 PM by Anonymous
Comments: teen porn http://www.xanga.com/teenprn teen porn
Left on 8/23/2007 11:22:11 PM by Anonymous
Comments: teen pussy http://www.xanga.com/teenpusy teen pussy
Left on 8/23/2007 4:26:13 PM by Anonymous
Comments: greenguys porn http://www.xanga.com/greenguysprn greenguys porn
Left on 8/23/2007 3:53:39 PM by Anonymous
Comments: hotpussy http://www.xanga.com/hotpussi hotpussy
Left on 8/23/2007 3:39:32 PM by Anonymous
Comments: incest sex http://www.xanga.com/incestsexxx incest sex
Left on 8/23/2007 3:37:11 PM by Anonymous
Comments: incest porn http://www.xanga.com/incestorn incest porn
Left on 8/22/2007 11:42:22 AM by Anonymous
Comments: fake tits http://www.xanga.com/bestvideos/611429555/fake-tits.html fake tits
Left on 8/22/2007 11:08:42 AM by Anonymous
Comments: fat pussy http://www.xanga.com/bestvideos/611429858/fat-pussy.html fat pussy
Left on 8/22/2007 10:51:57 AM by Anonymous
Comments: familysex http://www.xanga.com/bestvideos/611429784/familysex.html familysex
Left on 8/22/2007 10:24:20 AM by Anonymous
Comments: freewebcams http://www.xanga.com/bestvideos/611430447/freewebcams.html freewebcams
Left on 8/21/2007 10:41:38 PM by Anonymous
Comments: bigdicks http://www.xanga.com/bigdicksz bigdicks
Left on 8/21/2007 9:27:53 PM by Anonymous
Comments: beast sex http://www.xanga.com/Beast_Sex beast sex
Left on 8/21/2007 9:21:09 PM by Anonymous
Comments: bigpussy http://www.xanga.com/bigpussi bigpussy
Left on 8/14/2007 2:29:12 PM by Anonymous
Comments: Wonderful and informative web site.I used information from that site its great.
Left on 3/15/2007 6:44:57 PM by Anonymous
Comments: somestrangetextvista http://sdfsdfsdf.com
Left on 3/12/2007 9:44:51 AM by Anonymous
Comments: hi great site great work thank you

Left on 3/5/2007 11:36:35 PM by Anonymous
Comments: Nice layout. But i didnt find information for me that i try to find on your website. But thanks you in any way!
Left on 3/4/2007 5:31:59 PM by Anonymous
Comments:
No ratings available.
Left on 2/28/2007 10:38:50 AM by Anonymous
Comments: somestrangetextvista http://qwertyuiop.com
Left on 2/20/2007 12:46:30 PM by Anonymous
Comments: hello makakas http://www.wwwcoder.com/main/parentid/224/site/3507/68/default.aspx
Left on 2/8/2007 12:43:55 PM by Anonymous
Comments: Here is intresting people... Lets talk!
Left on 5/16/2006 12:32:57 PM by Anonymous
Comments: I'm trying to implement this in my web application I'm getting a null reference exception on "_formatter.Serialize(memStream, viewState)"
My class is set to inherit from System.Web.UI.Page (as this is not a DNN application)

Any ideas?
No ratings available.
Left on 1/5/2005 1:42:06 PM by Anonymous
Comments: Comments from the following blog: Patrick Santry's (aka wwwCoder) Blog, located at: http://blogs.wwwcoder.com/psantry/archive/0001/01/01/1294.aspx
No ratings available.
Left on 1/5/2005 1:39:38 PM by Anonymous
Comments: Comments from the following blog: Patrick Santry's (aka wwwCoder) Blog, located at: http://blogs.wwwcoder.com/psantry/archive/2005/01/05/1294.aspx
No ratings available.
Left on 1/4/2005 4:17:41 AM by Anonymous
Comments: Comments from the following blog: Stefano Demiliani WeBlog, located at: http://demiliani.com/blog/archive/2004/09/20/716.aspx
No ratings available.
Left on 9/24/2004 8:15:03 PM by krzysztof kleszynski
Comments: great job - as usual :)
No ratings available.
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970