ok,
I have a domain environment
Server1 is on the domain
Server2 is a webserver and is not part of the domain - is hosting the live website
Server1 has a folder called data which is shared
\\Server1\Data
WebUser has read and list permissions set on this folder
On webserver I have a vb.net application, that streams the files to download
I have setup a user called WebUser on the domain and the webserver with the same password and set it to impersonate user in web.config file
So when I try to stream file over the web, I can't ????
\\Server1\Data\file.pdf
However when I try to launch the the unc path in the webserver, it works
Please help - ??
sGetFile = \\Server1\Data\File.pdf
here is the code used to stream
Dim fs As New FileStream(sGetFile, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
Response.Buffer = True
Response.Clear()
'Response.ContentType = "application/pdf"
Dim sFileType As String = Right(sFile, (Len(sFile) - InStrRev(sFile, ".")))
Select Case LCase(sFileType)
Case "pdf"
Response.ContentType = ("application/pdf")
Case "doc"
Response.ContentType = ("application/msword")
Case "xls"
Response.ContentType = ("application/x-excel")
Case "pff"
Response.ContentType = ("application/ms-powerpoin
t")
Case "zip"
Response.ContentType = ("application/zip")
Case "tif"
Response.ContentType = ("image/tiff")
Case "gif"
Response.ContentType = ("image/gif")
Case "jpg", "jpeg"
Response.ContentType = ("image/jpeg")
Case "rtf"
Response.ContentType = ("image/rtf")
Case "txt"
Response.ContentType = ("text/plain")
Case Else
Response.ContentType = ("text/html")
'Response.Write("Error: Could not locate file for download: " & sFile)
'Response.End()
End Select
' Set headers
'If sFileType <> "txt" Then
Response.ContentEncoding = (Encoding.Unicode)
'End If
If sMode = "dl" Then
' Opens it outside browser
Response.AddHeader("conten
t-disposit
ion", "attachment; filename=" & sFile)
Else
' Opens it inside browser
Response.AddHeader("conten
t-disposit
ion", "inline; filename=" & sFile)
End If
' Opens it outside browser
Response.AddHeader("conten
t-disposit
ion", "attachment; filename=" & sFile)
' Opens it inside browser
'Response.AddHeader("conte
nt-disposi
tion", "inline; filename=" & sFile)
Response.BinaryWrite(MyDat
a)
fs.Flush()
fs.Close()
Start Free Trial