473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1668
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.Identity.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.IndexOf('\');
string domain = String.Empty;
if (domainPos > 0) {
domain = username.SubString(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.Identity.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.IndexOf('\');
string domain = String.Empty;
if (domainPos > 0) {
domain = username.SubString(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.Host
Dec 17 '05 #5

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

Similar topics

8
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...
2
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...
0
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...
0
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...
5
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...
22
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...
13
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...
18
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...
7
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...
0
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$) { } ...
0
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.