simulate virtual directory - I need it urgently

Discussion in 'ASP .Net' started by Amir Eshterayeh, Feb 3, 2004.

  1. Dear Friends

    Would you please give me your professional idea about this .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
     
    Amir Eshterayeh, Feb 3, 2004
    #1
    1. Advertising

  2. Amir Eshterayeh

    caviar Guest

    "Amir Eshterayeh" <> wrote in message
    news:%...
    > Dear Friends
    >
    > Would you please give me your professional idea about this .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



    Hi Andy,

    The document below explains how you should do this:

    http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/httphandler.mspx

    What you'r missing is probally on the bottom part of the article, the
    /subdir/ paths you want to rewrite need to be reditrected to the aspx http
    handler.

    Read the article, and you'll understand..

    regards hjm
     
    caviar, Feb 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott M.
    Replies:
    3
    Views:
    469
    Amir Eshterayeh
    Feb 3, 2004
  2. Janusz Jezowicz
    Replies:
    3
    Views:
    956
    Jennifer Mathews
    Nov 15, 2009
  3. Joey Liang via DotNetMonster.com

    Urgently need help in drop down list..thanx

    Joey Liang via DotNetMonster.com, May 24, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    610
    Joey Liang via DotNetMonster.com
    May 24, 2005
  4. Replies:
    1
    Views:
    342
  5. gauthier
    Replies:
    0
    Views:
    647
    gauthier
    Jun 30, 2005
Loading...

Share This Page