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 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP directory resolving!

    Hi there,

    I was just wondering, how I can solve this problem.

    I have got a site with thousands of members with their own profile, now what I want is that obviously has got their own link,

    www.mydomain.com/membername

    this then should resolve into www.mydomain.com/member.asp?id=124 or whatever number,

    now i know there is a way to do this, to create all member folders and have an index page in there that redirects to the members.asp, but the reason I want to do it this way is that I don't want to have 5000 folders on my server.

    Now my question is, how can i resolve a folder name into a filename + id... without having this folder,...

    cheers
    GzArIa

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Write a custom 404 Error page, which can still display the ordinary 404 error message when a regular error occurs but can redirect the user to the appropriate page when it's one of these pseudo pages.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New Coder
    Join Date
    Aug 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    another question!

    Thanks for your help. I think I got the idea.

    The only question I have got is, how do I actually read what the user typed into the URL bar.

    Let's say he typed in www.mydomain.com/membername, how can I read out membername and then redirect the page.

    Thanks for your help again.
    GzArIa

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's some of the code from my custom 404 Error page which should help get you started:

    Code:
    		<%
    		Dim ServerName                  ' HTTP server name
    		Dim PageInErrorHTTP				' Full URL to the page with the error
    		Dim PageInErrorRel				' Relative URL to the page with the error
    		Dim PageInErrorResolved			' Full Local path name of the page with the error
    		Dim UrlInErrorHTTP              ' Full URL to the missing file
    		Dim UrlInErrorRel				' Relative URL to the missing file
    		Dim UrlInErrorResolved          ' Full local path name of the missing file
    		Dim InServer					' Flag to speed processing when not user visible item
                    Dim T                                 ' Temporary variable
    		
    		on error resume next  ' Don't comment out, this page needs error checking enabled!
    		
    		InServer = 0
    		ServerName = Request.ServerVariables("HTTP_HOST")
    		If Request.ServerVariables("HTTP_REFERER") <> "" then
    			PageInErrorHTTP = LCase(Mid(Request.ServerVariables("HTTP_REFERER"),1))
    		else
    			PageInErrorHTTP = LCase(Mid(Request.ServerVariables("QUERY_STRING"),5))
    		end if
    		T = Instr (PageInErrorHTTP,ServerName) + Len(ServerName)
    		PageInErrorRel = Mid(PageInErrorHTTP,T)
    		PageInErrorRel = Replace(PageInErrorRel,"%5f","_",1,-1,1)
    		PageInErrorResolved = Server.Mappath(PageInErrorRel)
    		
    		UrlInErrorHTTP = LCase(Mid(Request.ServerVariables("QUERY_STRING"),5))
    		T = Instr (UrlInErrorHTTP,ServerName) + Len(ServerName)
    		UrlInErrorRel = Mid(UrlInErrorHTTP,T)
    		UrlInErrorResolved = Server.Mappath(UrlInErrorRel)
    		UrlInErrorRel = Replace(UrlInErrorRel,"%5f","_",1,-1,1)
    		
    		if Instr(UrlInErrorHTTP,"favicon.ico") > 1 then		' When a user of IE adds a Favorite we get this 404
    ' which we don't need a message about
    			InServer = 1
    		end if
    		
    		if Request.ServerVariables("REMOTE_ADDR") = Request.ServerVariables("LOCAL_ADDR") then
    ' When Site Server checks for the document title
    			InServer = 1									' We also want to skip sending messages
    		end if
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    New Coder
    Join Date
    Aug 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    great

    that's great stuff,...

    thanks helped me a lot,...


  •  

    Posting Permissions

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