Help! I'm in Server.MapPath Hell!

Results 1 to 4 of 4

Thread: Help! I'm in Server.MapPath Hell!

  1. #1
    CMac Guest

    Default Help! I'm in Server.MapPath Hell!

    Please help! The results page from my ASP Search show hypertext links that don&#039;t work. I am publishing out of FrontPage 2002 to a remote web host that supports ASP, 2002 extensions, etc.<BR><BR>For example, when I do a search on "school", I get a hypertext link that shows "file:///E:/web/", and when I click on them I get a "file not found" message. I would have expected the hypertext link to come back as "http://www.roswellnorthelementary/aboutRNE.htm".<BR><BR>I&#039;m reusing some excellent ASP Search code, consisting of 3 files (search.htm, search.asp and processdirectory.asp). I&#039;ve pasted the links to this code below.<BR><BR>- search.htm: <BR>,4413,2604132,00.html<BR><BR>- search.asp:<BR>,4413,2604139,00.html<BR><BR>- processdirectory.asp<BR>,4413,2604141,00.html<BR><BR>I&#039;ve tried 100 variations of the (Server.mapPath("/")) variable, but I can&#039;t get any search to work unless I use it exactly as it is above. I&#039;ve also browsed a lot of the FAQs here, and I can&#039;t find something (probably because I don&#039;t really understand ASP coding) that works.<BR><BR>Do you have any ideas on how to fix this?<BR><BR>Thanks!

  2. #2
    Joel N. Guest

    Default RE: Help! I'm in Server.MapPath Hell!

    In processDirectory.asp make this change:<BR><BR>Original code:<BR>strPath = replace(replace(objLocalFile.path,"c:inetpubwwwroo t",""),"\","/")<BR><BR>New code:<BR>strPath = replace(replace(UCase(objLocalFile.path),UCase"c:i netpubwwwroot"),""),"\","/")<BR><BR>The replace will fail if the capitalization is not the same. So it was comparing "C:Inetpubwwwroot" to "c:inetpubwwwroot". By either Upper-casing or Lower-casing both stirings you ensure a match.<BR><BR><BR>HTH

  3. #3
    Joel N. Guest

    Default Aw shucks, another TYPO

    strPath = replace(replace(UCase(objLocalFile.path),UCase"c:i netpubwwwroot"),""),"\","/")<BR><BR>should be:<BR><BR>strPath = replace(replace(UCase(objLocalFile.path),UCase("c: inetpubwwwroot"),""),"\","/")<BR><BR>Forgot a "(" after the second UCase.<BR><BR>

  4. #4
    CMac Guest

    Default RE: Aw shucks, another TYPO

    Joel - You&#039;re a genius and a hero!<BR><BR>Actually, your code did not specifically fix my problem. HOWEVER, you put me on the right path! Your code plus your rationale on why you were writing it that way solved my problem!<BR><BR>The code that works is ""E:web",""),"\","/")".<BR><BR>You put me down the "upper/lower case" road and got me to pay closer attention to the "c:/inetpub/wwwroot" verbage. It made me think that there was an inconsistency with the "E:/web/" verbage that I was seeing in my search results.<BR><BR>I really appreciate your help! I&#039;ll put a note in the search code about your contribution to debugging it!<BR><BR>Best wishes!<BR><BR>Christian

Posting Permissions

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