\\UNC and ASP

Discussion in 'ASP General' started by David R., Aug 14, 2006.

  1. David R.

    David R. Guest

    I have two servers. One contains the ASP web application (\\Server1) and
    the other contains the data files (\\Server2).

    I'm having some problem with the following "file download" code at line
    "adoStream.LoadFromFile(FPath)".

    The error is "ADODB.Stream error '800a0bba' / File could not be opened."

    Could someone please offer some suggestions?


    <%
    Response.Buffer = False
    Server.ScriptTimeout = 30000
    Response.ContentType = "application/x-unknown" ' arbitrary

    fn = "MyPhoto.jpg"
    fpath = "\\Server2\g$\files\MyPhoto.jpg"

    Response.AddHeader "Content-Disposition", "attachment; filename=" & fn
    Set adoStream = CreateObject("ADODB.Stream")
    chunk = 2048

    adoStream.Open()
    adoStream.Type = 1
    adoStream.LoadFromFile(FPath)
    iSz = adoStream.Size
    Response.AddHeader "Content-Length", iSz
    For i = 1 To iSz \ chunk
    If Not Response.IsClientConnected Then Exit For
    Response.BinaryWrite adoStream.Read(chunk)
    Next

    If iSz Mod chunk > 0 Then
    If Response.IsClientConnected Then
    Response.BinaryWrite adoStream.Read(iSz Mod chunk)
    End If
    End If

    adoStream.Close
    Set adoStream = Nothing
    Response.End
    %>
     
    David R., Aug 14, 2006
    #1
    1. Advertising

  2. "David R." <> wrote in message
    news:...
    >I have two servers. One contains the ASP web application (\\Server1) and
    >the other contains the data files (\\Server2).
    >
    > I'm having some problem with the following "file download" code at line
    > "adoStream.LoadFromFile(FPath)".
    >
    > The error is "ADODB.Stream error '800a0bba' / File could not be opened."
    >
    > Could someone please offer some suggestions?
    >
    >
    > <%
    > Response.Buffer = False
    > Server.ScriptTimeout = 30000
    > Response.ContentType = "application/x-unknown" ' arbitrary
    >
    > fn = "MyPhoto.jpg"
    > fpath = "\\Server2\g$\files\MyPhoto.jpg"



    This only works, if the anonymous user account IUSR_ has access rights over
    the network, and by default, it has not.
     
    Egbert Nierop \(MVP for IIS\), Aug 14, 2006
    #2
    1. Advertising

  3. David R.

    David R. Guest

    Could you please tell me how to set that up?

    Thank you.


    "Egbert Nierop (MVP for IIS)" <> wrote in
    message news:...
    >
    > "David R." <> wrote in message
    > news:...
    >>I have two servers. One contains the ASP web application (\\Server1) and
    >>the other contains the data files (\\Server2).
    >>
    >> I'm having some problem with the following "file download" code at line
    >> "adoStream.LoadFromFile(FPath)".
    >>
    >> The error is "ADODB.Stream error '800a0bba' / File could not be opened."
    >>
    >> Could someone please offer some suggestions?
    >>
    >>
    >> <%
    >> Response.Buffer = False
    >> Server.ScriptTimeout = 30000
    >> Response.ContentType = "application/x-unknown" ' arbitrary
    >>
    >> fn = "MyPhoto.jpg"
    >> fpath = "\\Server2\g$\files\MyPhoto.jpg"

    >
    >
    > This only works, if the anonymous user account IUSR_ has access rights
    > over the network, and by default, it has not.
    >
     
    David R., Aug 14, 2006
    #3
  4. http://www.aspfaq.com/show.asp?id=2168
    David R. wrote:
    > Could you please tell me how to set that up?
    >
    > Thank you.
    >
    >
    > "Egbert Nierop (MVP for IIS)" <> wrote in
    > message news:...
    >>
    >> "David R." <> wrote in message
    >> news:...
    >>> I have two servers. One contains the ASP web application
    >>> (\\Server1) and the other contains the data files (\\Server2).
    >>>
    >>> I'm having some problem with the following "file download" code at
    >>> line "adoStream.LoadFromFile(FPath)".
    >>>
    >>> The error is "ADODB.Stream error '800a0bba' / File could not be
    >>> opened."
    >>>
    >>> Could someone please offer some suggestions?
    >>>
    >>>
    >>> <%
    >>> Response.Buffer = False
    >>> Server.ScriptTimeout = 30000
    >>> Response.ContentType = "application/x-unknown" ' arbitrary
    >>>
    >>> fn = "MyPhoto.jpg"
    >>> fpath = "\\Server2\g$\files\MyPhoto.jpg"

    >>
    >>
    >> This only works, if the anonymous user account IUSR_ has access
    >> rights over the network, and by default, it has not.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Aug 14, 2006
    #4
  5. David R.

    David R. Guest

    I recreated the IUSR/IWAM accounts reset/resynced passwords on the remote
    server and gave them Full Control (figuring it was permissions thing).

    However this did not fix it and I still receive the same message.

    Here are my questions
    1. What permissions are need for the ADODB.Stream to read a remote
    filesystem (ie., what security context is it currently running under, please
    don't say SYSTEM)?

    2. If this is not possible are there any alternatives to the ADODB.Stream to
    download a file from a remote filesystem?



    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > http://www.aspfaq.com/show.asp?id=2168
    > David R. wrote:
    >> Could you please tell me how to set that up?
    >>
    >> Thank you.
    >>
    >>
    >> "Egbert Nierop (MVP for IIS)" <> wrote in
    >> message news:...
    >>>
    >>> "David R." <> wrote in message
    >>> news:...
    >>>> I have two servers. One contains the ASP web application
    >>>> (\\Server1) and the other contains the data files (\\Server2).
    >>>>
    >>>> I'm having some problem with the following "file download" code at
    >>>> line "adoStream.LoadFromFile(FPath)".
    >>>>
    >>>> The error is "ADODB.Stream error '800a0bba' / File could not be
    >>>> opened."
    >>>>
    >>>> Could someone please offer some suggestions?
    >>>>
    >>>>
    >>>> <%
    >>>> Response.Buffer = False
    >>>> Server.ScriptTimeout = 30000
    >>>> Response.ContentType = "application/x-unknown" ' arbitrary
    >>>>
    >>>> fn = "MyPhoto.jpg"
    >>>> fpath = "\\Server2\g$\files\MyPhoto.jpg"
    >>>
    >>>
    >>> This only works, if the anonymous user account IUSR_ has access
    >>> rights over the network, and by default, it has not.

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    David R., Aug 14, 2006
    #5
  6. "David R." <> wrote in message
    news:Oxpb0k%...
    >I recreated the IUSR/IWAM accounts reset/resynced passwords on the remote
    >server and gave them Full Control (figuring it was permissions thing).
    >
    > However this did not fix it and I still receive the same message.
    >
    > Here are my questions
    > 1. What permissions are need for the ADODB.Stream to read a remote
    > filesystem (ie., what security context is it currently running under,
    > please don't say SYSTEM)?
    >
    > 2. If this is not possible are there any alternatives to the ADODB.Stream
    > to download a file from a remote filesystem?


    What he means that you reconfigure IUSR account.

    Create a network user account, that is not a 'guest' member.
    Then apply that user to the anonymous account, and make sure that the
    \\SERVER\SHARE also allows that user and the NTFS permission on that remote
    file system allows that user.
     
    Egbert Nierop \(MVP for IIS\), Aug 15, 2006
    #6
  7. David R.

    David R. Guest

    So, on \\Server1, I would change the password for Server1\IUSR_Server1 in
    IIS.

    Then on \\Server2, I would create Server2\IUSR_Server1 account with the same
    password.

    Is this correct?


    "Egbert Nierop (MVP for IIS)" <> wrote in
    message news:...
    >
    > "David R." <> wrote in message
    > news:Oxpb0k%...
    >>I recreated the IUSR/IWAM accounts reset/resynced passwords on the remote
    >>server and gave them Full Control (figuring it was permissions thing).
    >>
    >> However this did not fix it and I still receive the same message.
    >>
    >> Here are my questions
    >> 1. What permissions are need for the ADODB.Stream to read a remote
    >> filesystem (ie., what security context is it currently running under,
    >> please don't say SYSTEM)?
    >>
    >> 2. If this is not possible are there any alternatives to the ADODB.Stream
    >> to download a file from a remote filesystem?

    >
    > What he means that you reconfigure IUSR account.
    >
    > Create a network user account, that is not a 'guest' member.
    > Then apply that user to the anonymous account, and make sure that the
    > \\SERVER\SHARE also allows that user and the NTFS permission on that
    > remote file system allows that user.
    >
     
    David R., Aug 15, 2006
    #7
  8. "David R." <> wrote in message
    news:...
    > So, on \\Server1, I would change the password for Server1\IUSR_Server1 in
    > IIS.
    >
    > Then on \\Server2, I would create Server2\IUSR_Server1 account with the
    > same password.
    >
    > Is this correct?


    No, since IUSR_ blah has no access rights on the network share.

    Just create DOMAIN\IUSR_blah

    and on both IIS servers, you configure these accounts, by applying them.

    These accounts, must be user accounts. It's a penalty in security so be
    aware of that.
     
    Egbert Nierop \(MVP for IIS\), Aug 15, 2006
    #8
    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. Erik Lindeblom

    ASP.net using UNC references and IIS 5.0

    Erik Lindeblom, Aug 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    536
    Anatoly
    Aug 6, 2003
  2. George Nevsky
    Replies:
    1
    Views:
    2,843
    Natty Gur
    May 16, 2004
  3. =?Utf-8?B?emVyb2thcm1h?=

    asp.net assemblies over UNC network shares

    =?Utf-8?B?emVyb2thcm1h?=, Feb 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,480
    jongalloway
    Feb 3, 2005
  4. =?Utf-8?B?cGpfc2VydmFkbWlu?=

    Running an asp.net application on a remote share (UNC) - parser er

    =?Utf-8?B?cGpfc2VydmFkbWlu?=, Jun 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,599
    =?Utf-8?B?cGpfc2VydmFkbWlu?=
    Jul 1, 2005
  5. Claudio
    Replies:
    0
    Views:
    150
    Claudio
    Jul 23, 2008
Loading...

Share This Page