\\UNC and ASP

D

David R.

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
%>
 
E

Egbert Nierop \(MVP for IIS\)

David R. said:
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.
 
D

David R.

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?
 
E

Egbert Nierop \(MVP for IIS\)

David R. said:
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.
 
D

David R.

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?
 
E

Egbert Nierop \(MVP for IIS\)

David R. said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top