Passing non existing IIS directory to ASP parameter

Discussion in 'ASP General' started by nungon, Jul 15, 2005.

  1. nungon

    nungon Guest

    Good morning,

    I have a web site in which 7 pages repeat once and again in thousands
    of folders. Why? because I want to keep, to the user view, the pretty
    url www.myweb.com/username/pageX.asp.

    As you can imagine, this makes maintenance hard, because when I make
    some update, I have to run a program to spread the change to the
    xthousands directories.

    A solution would be to change the url to
    www.myweb.com/pageX.asp?u=username but the url wont be so easy to
    remember, and probably it will not like our users.

    My question is, in which way can I simulate this last behaviour, but
    maintaining the "pretty" url, not only for accessing, but during the
    navigation. The trick would be to catch the inexisting directory name
    and pass it to the desired page as a parameter.

    I have asked many people about that, and nobody can help. I would
    appreciate someone of you can help me with this.

    Thanks in advance,
    Nungon.
     
    nungon, Jul 15, 2005
    #1
    1. Advertising

  2. nungon

    CJM Guest

    "nungon" <> wrote in message
    news:...
    > Good morning,
    >
    > I have a web site in which 7 pages repeat once and again in thousands
    > of folders. Why? because I want to keep, to the user view, the pretty
    > url www.myweb.com/username/pageX.asp.
    >
    > As you can imagine, this makes maintenance hard, because when I make
    > some update, I have to run a program to spread the change to the
    > xthousands directories.
    >
    > A solution would be to change the url to
    > www.myweb.com/pageX.asp?u=username but the url wont be so easy to
    > remember, and probably it will not like our users.
    >
    > My question is, in which way can I simulate this last behaviour, but
    > maintaining the "pretty" url, not only for accessing, but during the
    > navigation. The trick would be to catch the inexisting directory name
    > and pass it to the desired page as a parameter.
    >
    > I have asked many people about that, and nobody can help. I would
    > appreciate someone of you can help me with this.
    >
    > Thanks in advance,
    > Nungon.
    >


    If I understand you correctly...

    Set the page for each user to simply Server.Transfer to a common page
    elsewhere in the system... Changes to the common page will be reflected
    automatically in the pages for each user.

    Chris
     
    CJM, Jul 15, 2005
    #2
    1. Advertising

  3. nungon

    nungon Guest

    Thanks Chris.
    This, howerver, does not solve the problem, since I will had to keep
    the xthousands directories.
    I want to get rid of them, and just simulate that they exist.
    Moreover, with that solution, the user will not see the "pretty" url
    during the navigation.

    Rgds...Nungon.
     
    nungon, Jul 15, 2005
    #3
  4. nungon

    CJM Guest

    "nungon" <> wrote in message
    news:...
    > Thanks Chris.
    > This, howerver, does not solve the problem, since I will had to keep
    > the xthousands directories.
    > I want to get rid of them, and just simulate that they exist.
    > Moreover, with that solution, the user will not see the "pretty" url
    > during the navigation.
    >
    > Rgds...Nungon.
    >


    With Apache, you can use Mod_Rewrite to translate the 'pretty' URL in to the
    practical URL. There is no direct equivalent, but there are 3rd-party ISAPI
    filters that will do the same thing, but obvious you will have to pay for
    these...

    Eg...

    www.mydomain.com/user/page.asp translates to
    www.mydomain.com/commonpage.asp?username=user...

    I've just noticed that IISToolshed has a free ISAPI filter listed:
    http://www.iistoolshed.com/tools.aspx
    Chris
     
    CJM, Jul 15, 2005
    #4
  5. nungon

    swp Guest

    Nungon,

    CJM's initial response is still best. Your problem states that it is
    the users that are controling what you do, so keep the directories.
    They will each contain 1 file, which is the default file for your
    internet server (IIS, Apache, whatever). The contents of that 1 file
    will be an include file off the root of your web site. That include
    file will contain a simple page like this (which can be trimmed
    considerably):
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <META HTTP-EQUIV="Refresh"
    CONTENT="0;URL=http://www.whatever.org/Page0.asp">
    <title>Redirect Page</title>
    </head>
    <body>
    </body>
    </html>


    That immediately redirects them to the proper starting page. Use of
    frames will keep the URL on the browser's address bar pure, so they
    never know the difference.

    If your users are sophisticated enough to right-click and open a new
    window when clicking a link to another page, then they should not mind
    what is in the address bar.

    hth,

    swp
     
    swp, Jul 15, 2005
    #5
  6. nungon

    nungon Guest

    Thanks both.
    swp, your solution solves my problem with the maintenance of the asps,
    which is much.
    Nevertheless, I want to get rid of the xthousands directories.

    I will try the ISAPI mentioned by CJM, no matter if I have to pay
    something.

    Thanks again,
    Nungon.
     
    nungon, Jul 15, 2005
    #6
  7. nungon wrote:
    > I have a web site in which 7 pages repeat once and again in
    > thousands of folders. Why? because I want to keep, to the user
    > view, the pretty url www.myweb.com/username/pageX.asp...
    >
    > ...My question is, in which way can I simulate this last
    > behaviour, but maintaining the "pretty" url, not only for
    > accessing, but during the navigation.


    One possibility is a custom 404 handler. One really useful fact is that IIS
    sticks the entire URL into Request.QueryString when it encounters a 404. In
    the event that your URL does not exist, the QueryString looks like this:

    404;http://www.myweb.com/username/pageX.asp?d=05/24/2005&recid=465431

    (As a bonus, you still have access to QS elements the old fashioned way:
    Request.QueryString("recid").Item)

    If you parse the above string, you can get the username. Here is a JScript
    example:

    var a =
    String(Request.QueryString.replace(/(^.+\/\/)|(\?.+$)/g,"").split("/")

    Now a is an array with:

    a[0] = "www.myweb.com"
    a[1] = "username"
    a[2] = "pageX.asp"

    Perform a Server.Transfer or Server.Execute on pageX.asp...



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Jul 15, 2005
    #7
  8. nungon

    Steven Burn Guest

    Use a custom 404 to handle the "usernames" and re-direct to the appropriate
    "url";

    http://aspfaq.com/show.asp?id=2162

    That will allow you to get rid of the (x) directories

    e.g.;

    <script language="VBScript" runat=Server>
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FolderExists("./" &
    StripAfterRoot(Request.ServerVariables("URL"))) Then
    '// Folder exists so is probably not a user folder
    Else
    '// Folder does not exist so is probably a user folder
    End If

    Function StripAfterRoot(sPath)
    '// Get rid of the http:// prefix
    sPath = Replace(sPath, "http://", "")
    '// Strip the path needed
    <(root)> = (0)
    username = (1)
    page.xxx = (2)
    StripAfterRoot = Split(sPath, "/")(1)
    End Function
    </script>

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "nungon" <> wrote in message
    news:...
    > Good morning,
    >
    > I have a web site in which 7 pages repeat once and again in thousands
    > of folders. Why? because I want to keep, to the user view, the pretty
    > url www.myweb.com/username/pageX.asp.
    >
    > As you can imagine, this makes maintenance hard, because when I make
    > some update, I have to run a program to spread the change to the
    > xthousands directories.
    >
    > A solution would be to change the url to
    > www.myweb.com/pageX.asp?u=username but the url wont be so easy to
    > remember, and probably it will not like our users.
    >
    > My question is, in which way can I simulate this last behaviour, but
    > maintaining the "pretty" url, not only for accessing, but during the
    > navigation. The trick would be to catch the inexisting directory name
    > and pass it to the desired page as a parameter.
    >
    > I have asked many people about that, and nobody can help. I would
    > appreciate someone of you can help me with this.
    >
    > Thanks in advance,
    > Nungon.
    >
     
    Steven Burn, Jul 15, 2005
    #8
  9. nungon

    nungon Guest

    Many Thanks

    I will try all the solutions.

    So far I have tried (not in production) the ISAPI listed in IISToolshed
    IonicIsapiRewriter1.0 and runs perfectly.
    Just putting this in the ini ile

    RewriteRule ^/(.*)/pageX.asp(.*) /pageX.asp$2&username=$1

    and the work is done.

    I wonder if this kind of isapi is very resource consuming since I serve
    thousands of pages a minute.
    Anyone has experienced it?

    Rgds...Nungon.
     
    nungon, Jul 16, 2005
    #9
  10. nungon

    CJM Guest

    "nungon" <> wrote in message
    news:...
    >
    > I wonder if this kind of isapi is very resource consuming since I serve
    > thousands of pages a minute.
    > Anyone has experienced it?


    This kind of filter shouldn't be very resource consuming, but it depends on
    how well it was developed. The chances are it will be fine, but you'll find
    out soon enough...

    CJM
     
    CJM, Jul 18, 2005
    #10
    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. Christina N
    Replies:
    0
    Views:
    363
    Christina N
    Jun 21, 2004
  2. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: IIS errormessage referrs non-existing linenumber

    Phil Winstanley [Microsoft MVP ASP.NET], Jun 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    340
    Christina N
    Jun 21, 2004
  3. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: IIS errormessage referrs non-existing linenumber

    Phil Winstanley [Microsoft MVP ASP.NET], Jun 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    317
    Christina N
    Jun 21, 2004
  4. Mister B
    Replies:
    8
    Views:
    584
    Nick Keighley
    Aug 26, 2010
  5. Martin Martinos
    Replies:
    3
    Views:
    131
    Martin Martinos
    Nov 7, 2006
Loading...

Share This Page