473,789 Members | 2,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

One application... multiple domains

I am developing an application using ASP.NET 2.0. In this application, I need
to provide customized database-driven interfaces based on the domain name
that the user is accessing the application from. A list of these domains will
be avialable in a data table.

What is the most efficient way to determine which domain the application
should respond for each time a page is requested.

It would seem that executing a SQL query each time a page is requested would
be overkill... is there a better way to do this? I'm assuming there must be,
since applications like dotnetnuke can display different content for multiple
domains...

Thanx
Dec 15 '05 #1
4 1689
I would load your domain list into cache, like an array, etc. You can query
against the cached list which will be very fast. I do not know how often
your domain list changes, but you can keep it in cache for limited time, or
even setup a SQL Server callback to reset the cache if you are in 2005. I
have not done this yet, so you are on your own here.

"Ryan" wrote:
I am developing an application using ASP.NET 2.0. In this application, I need
to provide customized database-driven interfaces based on the domain name
that the user is accessing the application from. A list of these domains will
be avialable in a data table.

What is the most efficient way to determine which domain the application
should respond for each time a page is requested.

It would seem that executing a SQL query each time a page is requested would
be overkill... is there a better way to do this? I'm assuming there must be,
since applications like dotnetnuke can display different content for multiple
domains...

Thanx

Dec 16 '05 #2
How are you using the word "domain"? Do you mean Windows Domain - as in
a Domain Controller? In this case, you should be able to get the domain
name which is prefixed on the user's name (Page.User.Iden tity.Name) if
you have Windows Authentication enabled on the website (and anonymous
access disabled).

You then write logic to show different interfaces based on that domain
string.

You could even write a custom RoleProvider which uses the person's
domain name to determine their role. That way you could take advantage
of the role-based security built into the new ASP.NET 2.0 sitemap and
Navigation controls. That would allow you to declaratively decide which
navigation links will be displayed to each domain. For more info on role
based site navigation, check out this article:
http://weblogs.asp.net/scottgu/archi...20/431019.aspx

For help writing a custom RoleProvider, you can download my Visual
Studio template from here:
http://flimflan.com/blog/ASPNETRoleP...oTemplate.aspx

Just fill in the code for GetRolesForUser () to return the user's domain
name. Something like this:

public string[] GetRolesForUser (string username){
int domainPos = username.IndexO f('\');
string domain = String.Empty;
if (domainPos > 0) {
domain = username.SubStr ing(0, domainPos);
}
return new string[] { domain };
}
Joshua Flanagan
http://flimflan.com/blog
Dec 16 '05 #3
Well.... by "domain", I mean domain name, which I don't believe is the same
as a domain controller (right?). This is an application designed for public
(anonymous) users, and will not be using Windows Authentication.

Ryan

"Joshua Flanagan" wrote:
How are you using the word "domain"? Do you mean Windows Domain - as in
a Domain Controller? In this case, you should be able to get the domain
name which is prefixed on the user's name (Page.User.Iden tity.Name) if
you have Windows Authentication enabled on the website (and anonymous
access disabled).

You then write logic to show different interfaces based on that domain
string.

You could even write a custom RoleProvider which uses the person's
domain name to determine their role. That way you could take advantage
of the role-based security built into the new ASP.NET 2.0 sitemap and
Navigation controls. That would allow you to declaratively decide which
navigation links will be displayed to each domain. For more info on role
based site navigation, check out this article:
http://weblogs.asp.net/scottgu/archi...20/431019.aspx

For help writing a custom RoleProvider, you can download my Visual
Studio template from here:
http://flimflan.com/blog/ASPNETRoleP...oTemplate.aspx

Just fill in the code for GetRolesForUser () to return the user's domain
name. Something like this:

public string[] GetRolesForUser (string username){
int domainPos = username.IndexO f('\');
string domain = String.Empty;
if (domainPos > 0) {
domain = username.SubStr ing(0, domainPos);
}
return new string[] { domain };
}
Joshua Flanagan
http://flimflan.com/blog

Dec 16 '05 #4
Yes, a domain name is different from a domain controller. And an
internet domain name is very different than the Windows domain name that
I was thinking of.

If you want to know the internet DNS host name that the user entered in
their address bar, try:

Request.Url.Hos t
Dec 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2689
by: nickdu | last post by:
I'm trying to isolate "applications" into their own application domain within a single process. I've quoted applications because it's a logical representation of an application. Basically it consists of a bunch of components supplied by some application group. I got this to work, somewhat. The problem is that the application performs roughly (and this has not been measured, but a guess based on the rendering of the application GUI) 10x...
2
5716
by: TaeHo Yoo | last post by:
Hi all, I have a solution which contains multiple projects. Those multiple projects should share the same session. For example, users login, create the session for users then these session information should be accessed by multiple projects. How do I archieve this? Any tutorial out there? Thanks
0
2119
by: Fred Palmer | last post by:
Hi all, Can anyone point out some best practices for handling cookies with multiple domains aliases? The problem is that I've got a site with multiple domain aliases and I want them to all use the same cookie. This problem can arise with even one domain if you don't set the domain on the cookie correctly. For example: Don't set the domain to ".mydomain.com" (leave out the first ".". If user's come in from "mydomain.com" or if they...
0
1038
by: a_newcomb | last post by:
I have an asp.net application that clients connect to and block until data destined for the client is received, and subsequently routed down the connection. Because of this, it is possible that clients are connected for an extended period of time. When some event occurs to the web application, which forces the aspnet_wp.exe to create a new application domain for the application, is there any way to be notified of such event? Is there a...
5
3959
by: J-T | last post by:
I guess I'm a litte bit confused about app pool and worker process. In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated to a pool. If I assign only one application to a applicaton pool then: 1) Can I have multiple worker processes assigned to that pool? If yes,what is the advantage of doing so?
22
8942
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load utilities.dll just once? Thanks, Brett
13
8677
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need a login to show data. I want the user to login only once when he visits any of my domains.
18
2366
by: BDE Consulting | last post by:
I am going crazy. This has been a problem now for over a year and I have yet to figure out what is causing it. I have a single server that is running multiple domains. For this example I will list four domains all of which have the phpinfo.php file in their root directories. However, only one of them has working PHP. What am I doing wrong? http://www.lyricvault.com/phpinfo.php http://www.paynephotos.com/phpinfo.php
7
4851
by: =?Utf-8?B?U2hpdmEgUmFtYW5p?= | last post by:
I have a windows application with multiple forms & another web application. Now I need a parent EXE or Application which need to act as a container to these application. Example : My existing Web application : http://localhost/MyApp/Default.aspx My existing Win Application : existingWinApp.exe New Parent WinApp : NewWinApp.exe My new winapp will have a menu & below which I will have a form holder.
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.