Server.MapPath Object Question

Discussion in 'ASP General' started by Chris Guimbellot, Apr 9, 2004.

  1. Hello,

    ASP, VBScript, IIS5.

    I have used the Server.MapPath object in the past in my web sites. What I am
    trying to do is before I map a path, to see if the folder is there. If so,
    map it. If not, do something else.

    Is there a way to do this? I tried the following:

    If Server.MapPath("testfolder") = True Then
    Set objFile = Server.MapPath("testfolder")
    End If

    but of course that doesn't work because MapPath doesn't support a Boolean
    value. Any ideas on what I need to do to accomplish this? Thanks,

    Chris
    Chris Guimbellot, Apr 9, 2004
    #1
    1. Advertising

  2. Andrew,

    Thanks for such a quick response. I had just thought about that. I
    appreciate it. Thanks again.

    Chris

    "Andrew Urquhart" <> wrote in message
    news:qiFdc.134$...
    > Chris Guimbellot wrote:
    > > I have used the Server.MapPath object in the past in my web sites.
    > > What I am trying to do is before I map a path, to see if the folder
    > > is there. If so, map it. If not, do something else.
    > >
    > > Is there a way to do this? I tried the following:
    > >
    > > If Server.MapPath("testfolder") = True Then
    > > Set objFile = Server.MapPath("testfolder")
    > > End If
    > >
    > > but of course that doesn't work because MapPath doesn't support a
    > > Boolean value. Any ideas on what I need to do to accomplish this?

    >
    > Use the FolderExist method of the FileSystemObject in conjunction with
    > Server.MapPath. The return value of FolderExist() is the Boolean you're
    > looking for in your example.
    > --
    > Andrew Urquhart
    > - Contact: www.andrewu.co.uk/contact/
    > - Employ me: Front/middle tier ASP developer with WAI & web standards
    >
    >
    Chris Guimbellot, Apr 9, 2004
    #2
    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. Jon
    Replies:
    5
    Views:
    11,134
    Scott M.
    Jan 17, 2010
  2. Peter Row
    Replies:
    0
    Views:
    461
    Peter Row
    Mar 1, 2004
  3. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,134
    Juan T. Llibre
    Mar 11, 2007
  4. Replies:
    4
    Views:
    957
    Juan T. Llibre
    Oct 7, 2007
  5. AAaron123
    Replies:
    11
    Views:
    1,194
    AAaron123
    Sep 9, 2009
Loading...

Share This Page