Hi
The problem is impersonate got failure. But now i change the code, now the
impersontate is working fine. but its not dowloading the file. I have the
file on F drive and the sub folder having all the access to that particular
domain user.
after impersonate i writen the username, its shows the current username and
also its show the excat file path F:\Test\test foder\file1.pdf
Response.Write(System.Security.Principal.WindowsId entity.GetCurrent().Name())
This is the code I am using.. but its not downloading the file. I dont know
where the problem is.
code:
If impersonateValidUser(Session("WinLogin"), "ScanFiles.local",
Session("WinPassword")) Then
Dim spath As String
DownloadFile(CType(E.Item.Cells(0).Controls(0),
HyperLink).NavigateUrl, True)
undoImpersonation()
Else
' impersonation failed.
Response.Write("not ok")
End If
'-------------------------------
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 = "Application/pdf"
If forceDownload Then
Response.AppendHeader("content-disposition", "attachment;
filename=" & name)
Else
Response.AppendHeader("content-disposition", "inline;
filename=" & name)
End If
Response.Write(System.Security.Principal.WindowsId entity.GetCurrent().Name())
Response.WriteFile(path1)
Response.End()
End Sub
"Peter Rilling" wrote:
Where did you put the files. Most likely they are in a folder that does not
have the same permission ACLs that the rest of the website does. Make sure
that the physical folders of where you are placing the file have the same
security as the root folder for your site.
"Bala" <Ba**@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com... Hi
Thanks for the reply. Noww when I click the download button, its asking me
windows username and password window, Once i type the username with domain
and password, its download the file. when i clicked next files, its
download
the files without asking password. so where is the problem?
Thanks
bala
"Peter Rilling" wrote:
The browser cannot access files that are not under the virtual root.
Either move your files under the virtual root, or create some proxy web
page
that can access the files (for instance, you might have the page
download.aspx?filename=test.pdf).
"Bala" <Ba**@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
> Hi
>
> I displaying my pdf files ( F:\test\test1\test.pdf - for example file
> path)
> on datagrid for user download.
> when I right clik the link and its show like this
> file:///F:/test/test1/test.pdf.
> But the problem is its not dowloading the file. I am impersontating the
> my
> domain user account. I am sure there is simple mistake, but I cannt
> find
> that
> one. anyone please help me. can i use server.mappath?
>
>
> Thanks
> Balakumar