Path=Server.MapPath

Discussion in 'ASP General' started by c676228, Aug 5, 2008.

  1. c676228

    c676228 Guest

    Hi all,

    I have one line code in my program, occasionaly I will receive the following
    error:
    "The Path parameter for the MapPath method did not correspond to a known path"

    Path=Server.MapPath(sCertPath & "\" & order_id & ".pdf")


    I am wondering what is happening since every time I check my error log, the
    order_id value is not empty and sCertPath is a system variable.

    Why does Server.Mappath fail?

    can you share a hint?

    --
    Betty
    c676228, Aug 5, 2008
    #1
    1. Advertising

  2. Hi Betty,

    From your descrpition, you ocassionally get some error at the
    "Server.MapPath" call in your ASP application ,correct?

    According to the codesnippet you provided, the Server.MapPath parameter is
    concatenated via several string. As you said "sCerPath" is always
    fixed(from environment variable), then the only part may vary is the
    "order_id" variable, correct?

    I've performed some research, it seems some possible causes is the path
    contains some illegal characters, you can check the following thread:

    http://www.xlinesoft.com/asprunnerpro/articles/servermappath_use_strategy.ht
    m

    Also, a kb article mentioned the ".." parent path code is not allowed in
    Server.MapPath.

    http://support.microsoft.com/?id=332117

    Sincerely,

    Steven Cheng
    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no
    rights.--------------------

    >From: =?Utf-8?B?YzY3NjIyOA==?= <>
    >Subject: Path=Server.MapPath
    >Date: Tue, 5 Aug 2008 14:52:15 -0700


    >
    >Hi all,
    >
    >I have one line code in my program, occasionaly I will receive the

    following
    >error:
    >"The Path parameter for the MapPath method did not correspond to a known

    path"
    >
    >Path=Server.MapPath(sCertPath & "\" & order_id & ".pdf")
    >
    >
    >I am wondering what is happening since every time I check my error log,

    the
    >order_id value is not empty and sCertPath is a system variable.
    >
    >Why does Server.Mappath fail?
    >
    >can you share a hint?
    >
    >--
    >Betty
    >
    Steven Cheng [MSFT], Aug 6, 2008
    #2
    1. Advertising

  3. c676228

    Old Pedant Guest

    "c676228" wrote:
    > I have one line code in my program, occasionaly I will receive the following
    > error:
    > "The Path parameter for the MapPath method did not correspond to a known path"
    >
    > Path=Server.MapPath(sCertPath & "\" & order_id & ".pdf")


    Instead of *guessing* as our Microsoft friend would have you do, why not
    find out, for real?

    <%
    virtualPath = sCertPath & "/" & order_id & ".pdf" ' should always use /
    in virtual!
    path = "*BAD*"
    On Error Resume Next
    path = Server.MapPath(virtualPath)
    oops = Err.Description
    On Error GoTo 0
    If path = "*BAD*" Then ' means that the MapPath got the error!
    Response.Write "Server.MapPath reported error: " & oops _
    & "<p>The virtual path given was: " & virtualPath & "<HR>" &
    vbNewLine
    Response.End ' or you can try some recovery code...up to you
    End If
    %>

    Let the program find and diagnose the problem--WHEN it occurs--for you.
    Old Pedant, Aug 6, 2008
    #3
  4. Hi Betty,

    Have you got any progress on this issue? If there is anything else need
    help, please feel free to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------

    >From: (Steven Cheng [MSFT])
    >Organization: Microsoft
    >Date: Wed, 06 Aug 2008 03:48:29 GMT
    >Subject: RE: Path=Server.MapPath


    >
    >Hi Betty,
    >
    >From your descrpition, you ocassionally get some error at the
    >"Server.MapPath" call in your ASP application ,correct?
    >
    >According to the codesnippet you provided, the Server.MapPath parameter is
    >concatenated via several string. As you said "sCerPath" is always
    >fixed(from environment variable), then the only part may vary is the
    >"order_id" variable, correct?
    >
    >I've performed some research, it seems some possible causes is the path
    >contains some illegal characters, you can check the following thread:
    >
    >http://www.xlinesoft.com/asprunnerpro/articles/servermappath_use_strategy.h

    t
    >m
    >
    >Also, a kb article mentioned the ".." parent path code is not allowed in
    >Server.MapPath.
    >
    >http://support.microsoft.com/?id=332117
    >
    >Sincerely,
    >
    >Steven Cheng
    >Microsoft MSDN Online Support Lead
    >
    >
    >Delighting our customers is our #1 priority. We welcome your comments and
    >suggestions about how we can improve the support we provide to you. Please
    >feel free to let my manager know what you think of the level of service
    >provided. You can send feedback directly to my manager at:
    >.
    >
    >==================================================
    >Get notification to my posts through email? Please refer to
    >http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti

    f
    >ications.
    >
    >==================================================
    >This posting is provided "AS IS" with no warranties, and confers no
    >rights.--------------------
    >
    >>From: =?Utf-8?B?YzY3NjIyOA==?= <>
    >>Subject: Path=Server.MapPath
    >>Date: Tue, 5 Aug 2008 14:52:15 -0700

    >
    >>
    >>Hi all,
    >>
    >>I have one line code in my program, occasionaly I will receive the

    >following
    >>error:
    >>"The Path parameter for the MapPath method did not correspond to a known

    >path"
    >>
    >>Path=Server.MapPath(sCertPath & "\" & order_id & ".pdf")
    >>
    >>
    >>I am wondering what is happening since every time I check my error log,

    >the
    >>order_id value is not empty and sCertPath is a system variable.
    >>
    >>Why does Server.Mappath fail?
    >>
    >>can you share a hint?
    >>
    >>--
    >>Betty
    >>

    >
    >
    Steven Cheng [MSFT], Aug 11, 2008
    #4
    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,127
    Scott M.
    Jan 17, 2010
  2. Replies:
    0
    Views:
    2,230
  3. Alan Silver
    Replies:
    1
    Views:
    469
    Alan Silver
    Jun 28, 2005
  4. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,128
    Juan T. Llibre
    Mar 11, 2007
  5. Replies:
    4
    Views:
    951
    Juan T. Llibre
    Oct 7, 2007
Loading...

Share This Page