473,785 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file download

Hi

I displaying my pdf files ( F:\test\test1\t est.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 1687
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?f ilename=test.pd f).

"Bala" <Ba**@discussio ns.microsoft.co m> wrote in message
news:37******** *************** ***********@mic rosoft.com...
Hi

I displaying my pdf files ( F:\test\test1\t est.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?f ilename=test.pd f).

"Bala" <Ba**@discussio ns.microsoft.co m> wrote in message
news:37******** *************** ***********@mic rosoft.com...
Hi

I displaying my pdf files ( F:\test\test1\t est.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**@discussio ns.microsoft.co m> wrote in message
news:50******** *************** ***********@mic rosoft.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?f ilename=test.pd f).

"Bala" <Ba**@discussio ns.microsoft.co m> wrote in message
news:37******** *************** ***********@mic rosoft.com...
> Hi
>
> I displaying my pdf files ( F:\test\test1\t est.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.Wind owsIdentity.Get Current().Name( ))
This is the code I am using.. but its not downloading the file. I dont know
where the problem is.

code:

If impersonateVali dUser(Session(" WinLogin"), "ScanFiles.loca l",
Session("WinPas sword")) Then
Dim spath As String
DownloadFile(CT ype(E.Item.Cell s(0).Controls(0 ),
HyperLink).Navi gateUrl, True)
undoImpersonati on()
Else
' impersonation failed.
Response.Write( "not ok")
End If

'-------------------------------

Private Sub DownloadFile(By Val fname As String, ByVal forceDownload As
Boolean)
Dim path1 As String = fname
Dim name As String = Path.GetFileNam e(path1)

Dim ext As String = Path.GetExtensi on(path1)
Dim type As String = "Applicatio n/pdf"
If forceDownload Then
Response.Append Header("content-disposition", "attachment ;
filename=" & name)
Else
Response.Append Header("content-disposition", "inline;
filename=" & name)
End If

Response.Write( System.Security .Principal.Wind owsIdentity.Get Current().Name( ))
Response.WriteF ile(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**@discussio ns.microsoft.co m> wrote in message
news:50******** *************** ***********@mic rosoft.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?f ilename=test.pd f).

"Bala" <Ba**@discussio ns.microsoft.co m> wrote in message
news:37******** *************** ***********@mic rosoft.com...
> Hi
>
> I displaying my pdf files ( F:\test\test1\t est.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.Wind owsIdentity.Get Current().Name( ))
This is the code I am using.. but its not downloading the file. I dont know
where the problem is.

code:

If impersonateVali dUser(Session(" WinLogin"), "ScanFiles.loca l",
Session("WinPas sword")) Then
Dim spath As String
DownloadFile(CT ype(E.Item.Cell s(0).Controls(0 ),
HyperLink).Navi gateUrl, True)
undoImpersonati on()
Else
' impersonation failed.
Response.Write( "not ok")
End If

'-------------------------------

Private Sub DownloadFile(By Val fname As String, ByVal forceDownload As
Boolean)
Dim path1 As String = fname
Dim name As String = Path.GetFileNam e(path1)

Dim ext As String = Path.GetExtensi on(path1)
Dim type As String = "Applicatio n/pdf"
If forceDownload Then
Response.Append Header("content-disposition", "attachment ;
filename=" & name)
Else
Response.Append Header("content-disposition", "inline;
filename=" & name)
End If

Response.Write( System.Security .Principal.Wind owsIdentity.Get Current().Name( ))
Response.WriteF ile(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**@discussio ns.microsoft.co m> wrote in message
news:50******** *************** ***********@mic rosoft.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?f ilename=test.pd f).
>
> "Bala" <Ba**@discussio ns.microsoft.co m> wrote in message
> news:37******** *************** ***********@mic rosoft.com...
> > Hi
> >
> > I displaying my pdf files ( F:\test\test1\t est.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
6128
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 downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you will) works like a charm for .ZIP files and .TXT files. However, when .EXE files are downloaded...
0
1835
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 window. Well, thanks to Steve Orr, I have that working. However, I still have a few issues. First, the download dialog does not have the name of the file being downloaded in the "File name" field, instead it has the name of the aspx page that have...
1
5401
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 completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried, and all examples I have found that other people says works - doesn't work for me :-(
0
1749
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, identifies the template required then uses Response.AppendHeader to amend the response to create the file download dialogue. On my local machine this works fine and the download dialogue correctly identifies the file name and type attempting to be...
4
2335
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 dialog boxes that says something like "Do you want to download FILEX.txt?" I want the user to be able to download the file rather than have the file displayed in the browser, because the file will include some characters such as tabs and commas....
3
2142
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. The problem is that when you run the program it gets to the: Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name)
16
3258
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 not print in the username or email amddress of the person doing the download - which I am collecting from a form on the previous page. I can get the name and email address to print out normally, just not into the email sending body. I have...
35
9365
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 500000 to 3200000 of a file whose size is say 20MB... how do i request a download which starts directly at 500000th byte... thank u cheers
4
2425
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 become a nightmare. There is a log that gets generated in a regular basis and need to put most , but not all its contents in a DB (new or existent, it doesn't matter). because the fields that I need to cover are vertically and there is junk in...
1
47488
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.