We are designing a site with ASP.net 2.0. The question is regarding the
options avialble in asp.net 2.0 and the best one to use
Scenario
All the pages have a top menu bar and header. (We plan to make it as a
master page). Now the menu in the master page is based on roles that a person
is assigned to (Windows AD group). What is the best option to implement this?
1. Use the default asp.net framework and get the menu based on roles (thru
sitemap). But here there will be a hit to the personalization databse
(aspnetdb) for each page. How much of a performance issue is this?
2. make the menu as a user control and cache it. Is there a way to cache the
menu based on the roles. Can VaryByParam hold multiple parameters (multiple
roles of a user)?
3. Store the menu options available to the user in the user profile . But
then can the profile be refreshed when the role of the person changes (I
believe that profiles are mainly to be used to allow the user what he/she
wants to see rather than what u want to show them based on their roles.
Suggestions? Help?
Thanks! 8 1417
Hi getdotnet:
On Thu, 16 Jun 2005 17:22:02 -0700, getdotnet
<ge*******@discussions.microsoft.com> wrote: We are designing a site with ASP.net 2.0. The question is regarding the options avialble in asp.net 2.0 and the best one to use
Scenario All the pages have a top menu bar and header. (We plan to make it as a master page). Now the menu in the master page is based on roles that a person is assigned to (Windows AD group). What is the best option to implement this?
1. Use the default asp.net framework and get the menu based on roles (thru sitemap). But here there will be a hit to the personalization databse (aspnetdb) for each page. How much of a performance issue is this?
The default SiteMapProvider (XmlSiteMapProvider) reads an XML file
(web.sitemap) and doesn't hit a database. The sitemap is read into
memory once and then cached, since there will not be much of a perf
hit there.
--
Scott http://www.OdeToCode.com/blogs/scott/
Thanks Scott.
Could you (or someone) please answer my other question as well
The header aslo contains user information along with teh division of teh
person. Now this information has to be capyured from a database. What is the
best way to cache this info?
Should i contain the user and division info in a user control and cache it
based on some parameter using teh outputByParam in outputcache (parameter
being the user name?)
Or is there any better way to do it?
Thanks!
"Scott Allen" wrote: Hi getdotnet:
On Thu, 16 Jun 2005 17:22:02 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
We are designing a site with ASP.net 2.0. The question is regarding the options avialble in asp.net 2.0 and the best one to use
Scenario All the pages have a top menu bar and header. (We plan to make it as a master page). Now the menu in the master page is based on roles that a person is assigned to (Windows AD group). What is the best option to implement this?
1. Use the default asp.net framework and get the menu based on roles (thru sitemap). But here there will be a hit to the personalization databse (aspnetdb) for each page. How much of a performance issue is this?
The default SiteMapProvider (XmlSiteMapProvider) reads an XML file (web.sitemap) and doesn't hit a database. The sitemap is read into memory once and then cached, since there will not be much of a perf hit there.
-- Scott http://www.OdeToCode.com/blogs/scott/
Personally, I'd tend to favor caching of a user control - you'll cache
not just the data but also the rendering so it's the best bang for the
buck.
It probably won't be possible to use VaryByParam, it would be a bad
idea to identify the user based on a query string param, but you could
use VaryByCustom [1]and cache based on the user's name. The example
below caches based on browser type, but you could change the code..
[1] http://msdn.microsoft.com/library/de...sbestpract.asp
--
Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 21 Jun 2005 12:38:13 -0700, getdotnet
<ge*******@discussions.microsoft.com> wrote: Thanks Scott. Could you (or someone) please answer my other question as well
The header aslo contains user information along with teh division of teh person. Now this information has to be capyured from a database. What is the best way to cache this info? Should i contain the user and division info in a user control and cache it based on some parameter using teh outputByParam in outputcache (parameter being the user name?) Or is there any better way to do it?
Thanks!
I am now trying to cache the user control based on VaryByCustom. I have
overriden the GetVaryByCustomString in the Global .asax file
But the problem is that the Function GetVaryByCustomString is being called
only after the control has been initialized. I am doing the rendering in the
Load event of the user control. But the load event is being called much
before the GetVaryByCustomString function. So it does not pick up output from
cache.
The control is placed in a master page and the outputcache is declared like
this
<%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %>
What am I doing wrong??
"Scott Allen" wrote: Personally, I'd tend to favor caching of a user control - you'll cache not just the data but also the rendering so it's the best bang for the buck.
It probably won't be possible to use VaryByParam, it would be a bad idea to identify the user based on a query string param, but you could use VaryByCustom [1]and cache based on the user's name. The example below caches based on browser type, but you could change the code..
[1] http://msdn.microsoft.com/library/de...sbestpract.asp
-- Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 21 Jun 2005 12:38:13 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
Thanks Scott. Could you (or someone) please answer my other question as well
The header aslo contains user information along with teh division of teh person. Now this information has to be capyured from a database. What is the best way to cache this info? Should i contain the user and division info in a user control and cache it based on some parameter using teh outputByParam in outputcache (parameter being the user name?) Or is there any better way to do it?
Thanks!
What does your VaryByCustom code look like? I'll create a test here
over the weekend..
--
Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 23 Jun 2005 15:28:02 -0700, getdotnet
<ge*******@discussions.microsoft.com> wrote: I am now trying to cache the user control based on VaryByCustom. I have overriden the GetVaryByCustomString in the Global .asax file
But the problem is that the Function GetVaryByCustomString is being called only after the control has been initialized. I am doing the rendering in the Load event of the user control. But the load event is being called much before the GetVaryByCustomString function. So it does not pick up output from cache.
The control is placed in a master page and the outputcache is declared like this <%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %>
What am I doing wrong?? "Scott Allen" wrote:
Personally, I'd tend to favor caching of a user control - you'll cache not just the data but also the rendering so it's the best bang for the buck.
It probably won't be possible to use VaryByParam, it would be a bad idea to identify the user based on a query string param, but you could use VaryByCustom [1]and cache based on the user's name. The example below caches based on browser type, but you could change the code..
[1] http://msdn.microsoft.com/library/de...sbestpract.asp
-- Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 21 Jun 2005 12:38:13 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
>Thanks Scott. >Could you (or someone) please answer my other question as well > >The header aslo contains user information along with teh division of teh >person. Now this information has to be capyured from a database. What is the >best way to cache this info? >Should i contain the user and division info in a user control and cache it >based on some parameter using teh outputByParam in outputcache (parameter >being the user name?) >Or is there any better way to do it? > >Thanks! >
GetVaryByCustomString in Global.asax
Public Overrides Function GetVaryByCustomString(ByVal context As
System.Web.HttpContext, ByVal custom As String) As String
Dim userName As String
If custom = "UserId" Then 'we wish to cache this page by user id
userName = Profile.UserName
If Not userName Is String.Empty Then
Return userName
End If
End If
Return (GetVaryByCustomString(context, custom))
End Function
The user control (which i want to cache) in master page looks like this
<%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %>
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmpInfo.ascx.vb"
Inherits="EmpInfo" %>
<asp:Label ID="lblWelcome" runat="server" Text="Welcome, Logout"></asp:Label>
<asp:Label ID="lblDivision" runat="server" Text="Division"></asp:Label>
I am running this in debug mode and the page-load event of the user control
fires firts. After that the GetVaryByCustomString function is initialized.
Thanks for the help
"Scott Allen" wrote: What does your VaryByCustom code look like? I'll create a test here over the weekend..
-- Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 23 Jun 2005 15:28:02 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
I am now trying to cache the user control based on VaryByCustom. I have overriden the GetVaryByCustomString in the Global .asax file
But the problem is that the Function GetVaryByCustomString is being called only after the control has been initialized. I am doing the rendering in the Load event of the user control. But the load event is being called much before the GetVaryByCustomString function. So it does not pick up output from cache.
The control is placed in a master page and the outputcache is declared like this <%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %>
What am I doing wrong?? "Scott Allen" wrote:
Personally, I'd tend to favor caching of a user control - you'll cache not just the data but also the rendering so it's the best bang for the buck.
It probably won't be possible to use VaryByParam, it would be a bad idea to identify the user based on a query string param, but you could use VaryByCustom [1]and cache based on the user's name. The example below caches based on browser type, but you could change the code..
[1] http://msdn.microsoft.com/library/de...sbestpract.asp
-- Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 21 Jun 2005 12:38:13 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
>Thanks Scott. >Could you (or someone) please answer my other question as well > >The header aslo contains user information along with teh division of teh >person. Now this information has to be capyured from a database. What is the >best way to cache this info? >Should i contain the user and division info in a user control and cache it >based on some parameter using teh outputByParam in outputcache (parameter >being the user name?) >Or is there any better way to do it? > >Thanks! >
Hi getdotnet:
It's working for me.
The first time I load the webform in the master page with the user
control - Page_Load fires for the user control. then GetVaryByCustom
fires to get the cache string for the control. At that point the
control is cached.
If I refresh the page just the breakpoint on GetVaryByCustom is hit -
Page_Load is not. I am running this in debug mode and the page-load event of the user control fires firts. After that the GetVaryByCustomString function is initialized.
You mean on the first hit? That is normal. Is it still firing
Page_Load first on the 2nd hit?
--
Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 24 Jun 2005 06:29:09 -0700, getdotnet
<ge*******@discussions.microsoft.com> wrote:
GetVaryByCustomString in Global.asax
Public Overrides Function GetVaryByCustomString(ByVal context As System.Web.HttpContext, ByVal custom As String) As String Dim userName As String
If custom = "UserId" Then 'we wish to cache this page by user id userName = Profile.UserName If Not userName Is String.Empty Then Return userName End If End If Return (GetVaryByCustomString(context, custom))
End Function
The user control (which i want to cache) in master page looks like this
<%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %> <%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmpInfo.ascx.vb" Inherits="EmpInfo" %> <asp:Label ID="lblWelcome" runat="server" Text="Welcome, Logout"></asp:Label> <asp:Label ID="lblDivision" runat="server" Text="Division"></asp:Label>
I am running this in debug mode and the page-load event of the user control fires firts. After that the GetVaryByCustomString function is initialized.
Thanks for the help
Yes. It works. Thanks for your time.
"Scott Allen" wrote: Hi getdotnet:
It's working for me.
The first time I load the webform in the master page with the user control - Page_Load fires for the user control. then GetVaryByCustom fires to get the cache string for the control. At that point the control is cached.
If I refresh the page just the breakpoint on GetVaryByCustom is hit - Page_Load is not.
I am running this in debug mode and the page-load event of the user control fires firts. After that the GetVaryByCustomString function is initialized.
You mean on the first hit? That is normal. Is it still firing Page_Load first on the 2nd hit?
-- Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 24 Jun 2005 06:29:09 -0700, getdotnet <ge*******@discussions.microsoft.com> wrote:
GetVaryByCustomString in Global.asax
Public Overrides Function GetVaryByCustomString(ByVal context As System.Web.HttpContext, ByVal custom As String) As String Dim userName As String
If custom = "UserId" Then 'we wish to cache this page by user id userName = Profile.UserName If Not userName Is String.Empty Then Return userName End If End If Return (GetVaryByCustomString(context, custom))
End Function
The user control (which i want to cache) in master page looks like this
<%@OutputCache Duration="1800" VaryByParam="none" VaryByCustom="UserId" %> <%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmpInfo.ascx.vb" Inherits="EmpInfo" %> <asp:Label ID="lblWelcome" runat="server" Text="Welcome, Logout"></asp:Label> <asp:Label ID="lblDivision" runat="server" Text="Division"></asp:Label>
I am running this in debug mode and the page-load event of the user control fires firts. After that the GetVaryByCustomString function is initialized.
Thanks for the help
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: danaf |
last post by:
Dear all,
(1)Is it possible to host PHP-based Web Portal + MySQL Database (e.g.
PHPNuke) on MS Windows System? If yes which server software I need?
(2)Compare PHP over JSP/ASP/CGI in...
|
by: Accolo1 |
last post by:
Help we are looking for this person, do you know them?
William
wjohnson@accolo.com
Title: BEA WebLogic Portal Guru
Job #: 03-04468
Check the pulse of your career! Evolve our eCommerce web...
|
by: DKode |
last post by:
Ok,
My company is asking me to build a portal site for managers. I think I
have it down how I will structure the app, using C# and module based
pages like in the ibuyspy portal example. I plan...
|
by: Jason Dunbar |
last post by:
Having gone through to 'Site Settings' and then to ' SharePoint Portal
Server Central Administration' and to create a new portal site..
Once on the create new portal site screen, I choose to...
|
by: listname |
last post by:
A SharePoint portal is running at http://sitename/.
When I visit that web site, a dialog box comes up asking
for network domain/userid/password. I provide the details
and the site lets me in....
|
by: .net user |
last post by:
can some one point me what i'm doing wrong? I have spent half a day figuring
out and totally stuck now.
Here's what I'm trying to accomplish: I am writing a web appl - an intranet
portal site...
|
by: Juan Gil |
last post by:
I have a problem with this. I installed it in my computer to modify it, but
when I try to save the configuration file(xml file) the server returned an
error that say that I dont have permissions to...
|
by: luckystarduke |
last post by:
Location:Chicago or MN
Duration:- 6 months
The WebSphere Portal Server administration position requires a great
deal of flexibility, both in background and in skill set. Though some
tasks...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |