Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation URL ... but not real!

    I wanted to know what scripting code you will need to do the following:

    Say you want to go to http://www.kidzo.co.uk/gunu : but there really isn't a directory called "gunu" and it's just forwarding to this page:

    http://www.kidzo.co.uk/profiles.asp?id=gunu

    Example 2: http://www.kidzo.co.uk/admin will redirect to http://www.kidzo.co.uk/profiles.asp?id=admin

    (The "gunu" and "admin" are the usernames stored in my database!!!)

    --
    Thanks

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    A lot of times, this is done with Apache and Linux, not IIS.

    You would need to use code to create a "home" folder for every user that has access to your system. Then, in each folder, you would create (or copy) files to said directory so that they have access to the same information.

    The code you can use is the Scripting.FileSystemObject to create (or destroy) folders on your server.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Well, if I'm correct, you don't want to create new directories every time you add a new user and so just want a redirection to profiles.asp?id=username when someone puts in yourdomain.com/username.

    The only method I see here is that when they type in yourdomain.com/username, they're going to get a 404 error because the directory doesn't exist. What you can then do is create a custom 404 page (Instructions to do this) that has ASP code at the top that looks at the current web address, extracts the username in the URL, and attempts to redirect to profiles.asp?id=username. If you need help writing that code, just ask.

    -Shane

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    The only issue with doing it that way is that you are going to fill your IIS logs with 404 errors every time someone goes to log in or view those pages.

    If you administer the server, you need to keep this in mind.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    New Coder
    Join Date
    May 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How do you extract the username from http://www.kidzo.co.uk/admin
    ?

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    what you need is an ISAPI rewrite application. It gives you the chance to redirect to a different url, based on the url requested by the browser. It catches the url, rewrites it and serves back the page you want to serve. The beauty of it is that it doesnt change the url the user sees in the browser. Downside: you have to program, or find a free application (search for ISAPI_Rewrite, it has a free version) or buy a program.

    programming sample is here
    I am the luckiest man in the world

  • #7
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    create a custom 404 page is probably your fastest way that gets the url server var splits on / then you just want the last one then a response.redirect based off that then put in your profiles page somethign that does a username check against the db
    A programmer is just a tool which converts caffeine into code

    My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
    My hobby: http://www.angel-computers.co.uk
    My life: http://www.furious-angels.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •