473,395 Members | 2,437 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,395 software developers and data experts.

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_BeginRequest event in Global.asax
file:

dim sFolderName As String = Request.ApplicationPath.ToString.Trim("/")
dim AgentID as long = GetAgentIdByFolderName(sFolderName) 'from the
database
WriteAgentIdToCookie(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.ApplicationPath ? 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 1772
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*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.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_BeginRequest event in Global.asax file:

dim sFolderName As String = Request.ApplicationPath.ToString.Trim("/")
dim AgentID as long = GetAgentIdByFolderName(sFolderName) 'from the
database
WriteAgentIdToCookie(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.ApplicationPath ? 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*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.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_BeginRequest event in Global.asax file:

dim sFolderName As String = Request.ApplicationPath.ToString.Trim("/")
dim AgentID as long = GetAgentIdByFolderName(sFolderName) 'from the
database
WriteAgentIdToCookie(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.ApplicationPath ? 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
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...
1
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...
10
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...
8
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...
0
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...
7
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...
3
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...
2
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...
9
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...
0
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...
0
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,...

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.