Retrieving form data (part 2)

Discussion in 'C#' started by red_fiesta, Nov 8, 2006.

  1. #1
    Is there a way in asp to retrieve part of the URL and use it

    say the url was

    http://localhost/site/craig/default.asp
    or
    http://localhost/site/craig/test.asp
    or
    http://localhost/site/craig/roger.asp?dan=1

    is there anyway of retrieving the word craig so to use it in the page, I just want the word Craig

    This is because i could have other addresses that are for example

    http://localhost/site/jon/default.asp
    or
    http://localhost/site/jon/test.asp
    or
    http://localhost/site/jon/roger.asp

    where i need to retrieve the word jon

    at the moment i use the code

    strURL = Replace(Request.ServerVariables("URL"), "/default.asp", "")

    intStart = instrRev(strURL, "/") + 1
    strName = mid(strURL, intStart)

    this worked fine until new pages are added ie a page that isnt default.asp

    Obviously i cant use strURL = Replace(Request.ServerVariables("URL"), "/default.asp", "") because default.asp will change...

    please advise

    thanks
     
    red_fiesta, Nov 8, 2006 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    dude a few days ago I gave you the EXAMPLE WHERE YOU HAD TO CHANGE ONE NUMBER ONLY and YOU HAD THE ANSWER TO YOUR NEW QUESTION
     
    ludwig, Nov 8, 2006 IP
  3. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, sorry hadnt seen that bit.. :)

    it works

    thanks
     
    red_fiesta, Nov 8, 2006 IP