G
Guest
Hi
Currently I am displaying the list of files name on my datagrid. The files
physcially stored on network machine call TestMachine, not in the webserver.
r
In grid the file path says "file:\\Testmachine\Arc\Folders\test.pdf"
I already created the username and password for those folder and
Impersonating. thats working fine. after impersonating when i try to access
that file i am getting this error.
'Logon failure: unknown user name or bad password.'
I am using the below code for downloading file.
In that fucntion still the below line, its working fine. when i comment the
below line its download files.but all files are junk.
Response.WriteFile(path1)
thanks
bala
Private Sub DownloadFile(ByVal fname As String, ByVal forceDownload As
Boolean)
Dim path1 As String = fname
Dim name As String = Path.GetFileName(path1)
Dim ext As String = Path.GetExtension(path1)
Dim type As String = ""
If Not (ext Is Nothing) Then
Select Case ext.ToLower
Case ".htm", ".html"
type = "text/HTML"
' break
Case ".txt"
type = "text/plain"
' break
Case ".doc", ".rtf"
type = "Application/msword"
' break
Case ".pdf"
type = "Application/pdf"
End Select
End If
If forceDownload Then
Response.AppendHeader("content-disposition", "attachment;
filename=" + name)
End If
If Not (type = "") Then
Response.ContentType = type
End If
Response.WriteFile(path1)
Response.End()
End Sub
Currently I am displaying the list of files name on my datagrid. The files
physcially stored on network machine call TestMachine, not in the webserver.
r
In grid the file path says "file:\\Testmachine\Arc\Folders\test.pdf"
I already created the username and password for those folder and
Impersonating. thats working fine. after impersonating when i try to access
that file i am getting this error.
'Logon failure: unknown user name or bad password.'
I am using the below code for downloading file.
In that fucntion still the below line, its working fine. when i comment the
below line its download files.but all files are junk.
Response.WriteFile(path1)
thanks
bala
Private Sub DownloadFile(ByVal fname As String, ByVal forceDownload As
Boolean)
Dim path1 As String = fname
Dim name As String = Path.GetFileName(path1)
Dim ext As String = Path.GetExtension(path1)
Dim type As String = ""
If Not (ext Is Nothing) Then
Select Case ext.ToLower
Case ".htm", ".html"
type = "text/HTML"
' break
Case ".txt"
type = "text/plain"
' break
Case ".doc", ".rtf"
type = "Application/msword"
' break
Case ".pdf"
type = "Application/pdf"
End Select
End If
If forceDownload Then
Response.AppendHeader("content-disposition", "attachment;
filename=" + name)
End If
If Not (type = "") Then
Response.ContentType = type
End If
Response.WriteFile(path1)
Response.End()
End Sub