473,766 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simulate virtual directory for each user

simulate virtual directory for each user

Dear Friends

Would you please give me your professional idea about this asp.net problem.

I need different virtual directory for different customer with their names
like these:
www.oursite.com/Jack
www.oursite.com/Sue
www.oursite.com/Tom

I have a asp.net project. It is a website and the content of it WebPages
comes from database.
To give each user a virtual directory, I have 2 options:
1. create a virtual directory for each user and copy the asp.net project to
each directory
This is not a good solution.
2. Copy all the files to root directory (www.oursite.com) and when users
type
www.ourwebsite.com/jack or www.ourwebsite.com/sue, I can figure out the name
(jack or sue) and get the id of the user from database and bring the content
of that user's web pages from database.

I put the following code into Application_Beg inRequest event in Global.asax
file:

dim sFolderName As String = Request.Applica tionPath.ToStri ng.Trim("/")
dim AgentID as long = GetAgentIdByFol derName(sFolder Name) 'from the
database
WriteAgentIdToC ookie(AgentID)
Server.Transfer ("AgentHomePage .aspx")

After writing the agent Id to client's cookie, I redirect to agent home page
and at this page, I read cookie and get agent id and bring the agent info
like its picture URL and home page info from database.

The problem is: When I type : www.oursite.com/Jack
I faced this error: page can not be found!

Do you think global.asax is a good place to put this code? and also this
code: Request.Applica tionPath ? HttpRequest or something?
Is there a better way to get what user typed I mean the folder name that
comes after my website.

I got web hosting service from another company so I do not have any control
over that company's IIS. I could not found a way in its web hosting's admin
site to set the default page. Any page with default or index name will come
when I type www.oursite.com without including file name.

Please help. Thank you very much in advance

Best Regards
Andy Eshtry

Jul 21 '05 #1
2 1803
Edit web.config and create a handler for the different URLs. You don't need
to create physical or virtual directories. The MSDN reference has examples
of how to use HttpHandler to do this. It's actually very easy.
--
_______________ _____
Klaus H. Probst, MVP
http://www.vbbox.com/

"Amir Eshterayeh" <ae*********@ho tmail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
simulate virtual directory for each user

Dear Friends

Would you please give me your professional idea about this asp.net problem.
I need different virtual directory for different customer with their names
like these:
www.oursite.com/Jack
www.oursite.com/Sue
www.oursite.com/Tom

I have a asp.net project. It is a website and the content of it WebPages
comes from database.
To give each user a virtual directory, I have 2 options:
1. create a virtual directory for each user and copy the asp.net project to each directory
This is not a good solution.
2. Copy all the files to root directory (www.oursite.com) and when users
type
www.ourwebsite.com/jack or www.ourwebsite.com/sue, I can figure out the name (jack or sue) and get the id of the user from database and bring the content of that user's web pages from database.

I put the following code into Application_Beg inRequest event in Global.asax file:

dim sFolderName As String = Request.Applica tionPath.ToStri ng.Trim("/")
dim AgentID as long = GetAgentIdByFol derName(sFolder Name) 'from the
database
WriteAgentIdToC ookie(AgentID)
Server.Transfer ("AgentHomePage .aspx")

After writing the agent Id to client's cookie, I redirect to agent home page and at this page, I read cookie and get agent id and bring the agent info
like its picture URL and home page info from database.

The problem is: When I type : www.oursite.com/Jack
I faced this error: page can not be found!

Do you think global.asax is a good place to put this code? and also this
code: Request.Applica tionPath ? HttpRequest or something?
Is there a better way to get what user typed I mean the folder name that
comes after my website.

I got web hosting service from another company so I do not have any control over that company's IIS. I could not found a way in its web hosting's admin site to set the default page. Any page with default or index name will come when I type www.oursite.com without including file name.

Please help. Thank you very much in advance

Best Regards
Andy Eshtry


Jul 21 '05 #2
See my reply in the ASP.NET NG and please don't cross-post.
"Amir Eshterayeh" <ae*********@ho tmail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
simulate virtual directory for each user

Dear Friends

Would you please give me your professional idea about this asp.net problem.
I need different virtual directory for different customer with their names
like these:
www.oursite.com/Jack
www.oursite.com/Sue
www.oursite.com/Tom

I have a asp.net project. It is a website and the content of it WebPages
comes from database.
To give each user a virtual directory, I have 2 options:
1. create a virtual directory for each user and copy the asp.net project to each directory
This is not a good solution.
2. Copy all the files to root directory (www.oursite.com) and when users
type
www.ourwebsite.com/jack or www.ourwebsite.com/sue, I can figure out the name (jack or sue) and get the id of the user from database and bring the content of that user's web pages from database.

I put the following code into Application_Beg inRequest event in Global.asax file:

dim sFolderName As String = Request.Applica tionPath.ToStri ng.Trim("/")
dim AgentID as long = GetAgentIdByFol derName(sFolder Name) 'from the
database
WriteAgentIdToC ookie(AgentID)
Server.Transfer ("AgentHomePage .aspx")

After writing the agent Id to client's cookie, I redirect to agent home page and at this page, I read cookie and get agent id and bring the agent info
like its picture URL and home page info from database.

The problem is: When I type : www.oursite.com/Jack
I faced this error: page can not be found!

Do you think global.asax is a good place to put this code? and also this
code: Request.Applica tionPath ? HttpRequest or something?
Is there a better way to get what user typed I mean the folder name that
comes after my website.

I got web hosting service from another company so I do not have any contro l over that company's IIS. I could not found a way in its web hosting's admin site to set the default page. Any page with default or index name will come when I type www.oursite.com without including file name.

Please help. Thank you very much in advance

Best Regards
Andy Eshtry


Jul 21 '05 #3

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

Similar topics

4
3725
by: Mark Hoagland | last post by:
I've got a scenario with a web application where I must access the virtual directory being accessed from within the Application_OnStart event handler. Specifically, I have a series of IIS virtual directories which all point to the same set of ASP pages. However, since each virtual directory is a separate 'application', each has its own set data which must be cached. To detect which data must be cached for each virtual directory, I need to...
1
1646
by: Odie | last post by:
Hello, This probably seems like a silly question, but is it possible to have more than 1 ASP.Net project per virtual directory? The reason I'm wondering this, is because we already have an ASP.Net web-project written in C#, but need to include some legacy .ASP files written with (of course) VBScript. It would be easier to convert the legacy .ASP files into an ASP.Net project w/ VB than C#. But then we would have 2 projects sharing the...
10
3658
by: Wm. Scott Miller | last post by:
We have a intranet site that allows one of our departments to search a set of pdfs and then look at them. Only problem is that only they and us geeks should be allowed to see the pdfs. We have it locked down except for when a person directly types in the url to a pdf. Currently, the PDFs are in a virtual directory off the root of the server. Putting it under the search site also doesn't work. My understanding is that IIS looks as the...
8
3398
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set it up as C:\domains\appA. Locally, my IIS root points to C:\domains. I don't point it to C:\domains\appA since if I have an appB under C:\domains I wouldn't be able to get to it. So to access it via my browser I go to localhost/appA.
0
1188
by: Drew Berkemeyer | last post by:
Hello, I've been trying all day to create an installer for an ASP.NET application that has a sub-app running in a virtual directory under the primary app. Specifically, I have an ASP.NET application that needs to be installed on a server. Then I also have an other ASP.NET application that needs to be setup as a virtual directory, regisered as an iis application, under the primary application complete with it's own bin folder.
7
2345
by: J Smithers | last post by:
I have several ASPX pages (with code-behind logic) that I reuse amongst many Web sites on the same production server. Currently each Web site has its own copy of these aspx pages. I was thinking that it might be a good idea to move these common aspx pages to a new folder and then make them accessible via a new virtual directory in each Web site. Is this a good idea? Bad idea? Thoughts, opinions? Thanks!
3
1506
by: dph | last post by:
I have an asp.net application that I need to run from multiple different virtual directories. However, I don't want simply copy an instance of the application into each of these directories as that would be a maintenance nightmare. Also, each of these directories will need to have a separate copy of the web.config. I was hoping it would be as simple as a Server.Execute in a default page within each virtual directory that loaded the...
2
336
by: Amir Eshterayeh | last post by:
simulate virtual directory for each user Dear Friends Would you please give me your professional idea about this asp.net problem. I need different virtual directory for different customer with their names like these: www.oursite.com/Jack www.oursite.com/Sue
9
2594
by: antonyliu2002 | last post by:
I have a C# class GeneralUtilities.cs , which many of my aspx.cs files will refer to. So, I've put it under the App_Code folder and compiled it to library using csc /target: library from the DOS console. I can use objects of type GeneralUtilities in any aspx.cs file in my web application without any problem if only I make my web application folder a virtual directory. If I don't make it a virtual directory, the compiler complains...
0
9404
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,...
1
9959
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
9838
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...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
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
6651
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
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.