473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

file download

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
Nov 19 '05 #1
5 1651
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

Nov 19 '05 #2
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


Nov 19 '05 #3
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


Nov 19 '05 #4
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


Nov 19 '05 #5
Any help please.

bala

"Bala" wrote:
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
>
>
>


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
0
by: Buddy Ackerman | last post by:
I am trying to implment a file download via a link such that when clicked, instead of starting the default application for that type of file the user will be presented with a download dialog...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
0
by: Rhys666 | last post by:
Basically I have a link that opens my download page and the querystring identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring,...
4
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those...
3
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. ...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
4
by: Roberto Mora | last post by:
I have not done programming in a very long time and what is worst, I never learned VB. Although my job does not require this knowledge, I cam across a problem that although it seemed simple it has...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.