Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 1st, 2007, 06:23 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default theme selector from profile

Hello,

tell me one thing:

How it is possible to know profTheme.Preferences.Theme of user that is seeing the page?
It has of being made a linking to the database, right?

With this code in basePage:

Code:
Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)
            Dim id As String = Globals.ThemesSelectorID

            If id.Length > 0 Then
                Dim profTheme As ProfileCommon = HttpContext.Current.Profile
                If Me.Request.Form("__EVENTTARGET") = id AndAlso _
                        Not String.IsNullOrEmpty(Me.Request.Form(id)) Then
                    Me.Theme = Me.Request.Form(id)
                    profTheme.Preferences.Theme = Me.Theme
                Else
                    If Not String.IsNullOrEmpty(profTheme.Preferences.Theme) Then
                        Me.Theme = profTheme.Preferences.Theme
                    End If
                End If
            End If

            MyBase.OnPreInit(e)
        End Sub


The system make one connection to database(adding to all the others throughout the page) everytime the page is postback...

Are you sure this is a good strategy ?

Thanks

  #2 (permalink)  
Old July 1st, 2007, 10:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know if the ASP.NET 2.0 Profile provider for SQL Server includes caching or not. Maybe it does not, so every page hit goes all the way to SQL Server. Each page hit probably does anyway for other things. This is probably not a serious slowdown but you could do some benchmarking to see if it has an effect.

You could always cache it yourself by simply remembering the value you get the first time, and then sticking it in session state. Or you could stick it in the cache along with user identification (I'd use session). But the profile concept is very easy to use and I'd try to avoid doing my own cache unless a benchmark test should that it is a bottleneck. Out of process session state would probably be as slow as hitting SQL Server, so any kind of cache here probably only makes sense with in process session state, or the data cache with the extra code to isolate it by user.

You have to remember that SQL Server caches query plans and this is an indexed hit into a table. It's probably very fast. The frequently requested DB table pages will be kept in memory on the SQL Server box so that helps, also. Just the pain of leaving your IIS process and going over to a SQL process is the biggest hit. Perhaps only a few milliseconds...

Eric
  #3 (permalink)  
Old July 1st, 2007, 10:35 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Englere,

Don't be mad about what I go to say, but I have found all the pages based on “theBeerHouse” very slow… and I have to understand Why!!

Maybe it's all that little things!

This site it's slower than thePhille... Even on my localmachine (TheBeerHouse sourceCode).

With "thePhile" i have a forum with thousands of posts but every page render fast!
In theBeerHouse i have to wait for a (2...3seconds) "blank screen" every time navigate from page to other page...
Everytime that I go to your page i have to wait (4...5 seconds)

I have a 16Mb InternetConnection

Maybe it is bad luck with hostingCompanies...

Max

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Theme Selector wont pick up other theme Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 May 4th, 2007 08:44 AM
OptionButtons as workbook sheet selector frankjuel Excel VBA 8 February 27th, 2007 05:32 PM
theme selector rav BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 12th, 2007 12:44 AM
theme selector inputcontrol highlight issue michaelitrn BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 10th, 2006 02:58 PM
Slot Selector motupally Classic ASP Basics 0 July 28th, 2003 05:03 AM



All times are GMT -4. The time now is 12:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.