473,789 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Initiate Masked File Download

jwf
I am developming a web application in ASP.NET (VB) and am looking to develop
functionality where a user clicks on a link to download a file but at no
point can the user see the actual URL link to the file.

When the file is originally uploaded to the webserver it will be given a
unique random filename and the link to the file + description sill be stored
in sql server.

Basically the system must be secure so that a user MUST go through the
asp.net application to download the file and at no point should a user be
able to guess a URL to initiate a file download or access the file via the
history of the browser.

The system must also be X browser compatible.

I have a few ideas on how to do this already but I would appreciate feedback
and ideas from other developers who have had experience with this particular
issue.
Thanks
Sep 25 '06 #1
2 1743
All you need is an "engine" page that provides the download. IT will have to
change MIME types to the proper type for the file and serve the binary
stream. As long as the files are not too large, everything should be fine.
If you are dealing with very large files, they may fail to download due to
timeouts.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************** *************** *************** ****
Think outside of the box!
*************** *************** *************** ****
"jwf" <jw*@newsgroups .nospamwrote in message
news:3A******** *************** ***********@mic rosoft.com...
>I am developming a web application in ASP.NET (VB) and am looking to
develop
functionality where a user clicks on a link to download a file but at no
point can the user see the actual URL link to the file.

When the file is originally uploaded to the webserver it will be given a
unique random filename and the link to the file + description sill be
stored
in sql server.

Basically the system must be secure so that a user MUST go through the
asp.net application to download the file and at no point should a user be
able to guess a URL to initiate a file download or access the file via the
history of the browser.

The system must also be X browser compatible.

I have a few ideas on how to do this already but I would appreciate
feedback
and ideas from other developers who have had experience with this
particular
issue.
Thanks


Sep 25 '06 #2
Thanks for Gregory's input.

Hi Jwf,

As Gregory has mentioned, you can create an ASP.NET page which just will
take some querystring parameter(to indicate the parameter for locate the
file in database or disk), and then use the System.IO's code to read the
file content and flush it into page's response stream. Also, you need to
add some http headers to let the client browser prompt user for file
download.

For example:

=============== ======
protected void Page_Load(objec t sender, EventArgs e)
{
Response.Clear( );
Response.ClearH eaders();

Response.Conten tType = "applicatio n/octet-stream";

string path = "d:\\fileroot\\ " + Request.QuerySt ring["fn"];

Response.WriteF ile(path);

Response.End();
}
=============== ========

You can even add access control checking against the page so that only
limited users and access it. Here are some web articles also discussing on
this:
#ASP.NET Tip: Control Access to a File Download
http://www.codeguru.com/cpp/i-n/inte...le.php/c12529/
#How To Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
http://support.microsoft.com/kb/306654/en-us
Hope this helps also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 26 '06 #3

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

Similar topics

1
1608
by: toedipper | last post by:
Hello, php and mysql I have the code below. It's a mixture of my hand coding and dreamweaver created code. It's meant to log a download and then start the download. I can do the first part ok as I can check the db and see that there is an entry but the download won't start, it just sits there and nothing downloads.
0
1939
by: Gandalf | last post by:
Hi Gurus! Here is a problem with wxPython. I would like to load bitmaps and create a mask for them at once. Here is my idea: the mask colour for the bitmap should be the colour of the pixel in the top left corner. (The same way Delphi does with TImageList.) E.g. the bitmap should be transparent everywhere with the same colour. I read the documentation, and I could not find an easy way to do this. Here is what I have tried:
4
10836
by: jef | last post by:
I have a page (I call FileDownload" that intitiates a download of the filename passed to it. I called it from another page via javascript: window.open("FileDownload?file=blahblh"); it works fine but opens a blank browser window when it pops up the download dialog (my target browser is IE).... someone suggested I use an Iframe on the calling page so the blank browser window doesn't appear. So i created a hidden frame on the page, but...
1
3479
by: Kostis | last post by:
Hello there! I have created a windows application in VB.NET and I want to retrieve data from an access database. I create the OleDbConnection, an OleDbAdapter, a dataset and finally a Data Form using the Data Form Wizard. Everything works fine. The problem is that I want to use the masked edit control to manage the way some fields appear, and are being stored to the database. I insert the "Microsoft Masked Edit Control, version 6.0" (Path...
2
5180
by: Steve | last post by:
Hi, I'm trying to design a web server where users can login, initiate long running processes on uploaded files, monitor the progress via a web page and download some results when the process has finished. My first attempt was to do the file processing in the servlet, but the browser timed out eventually! I appreciate this is not the way to solve it! I was wondering if there is a common mechanism for doing this sort of thing
3
9139
by: dmbuso | last post by:
I have a money field defined in a SQL Server 05 database with a value of 49.50. Also, it displays in SQL Server as 49.5000. I have a form in VB.NET 2005 and I'm using the new MaskedTextBox control in Visual Studio. I set the Mask property for the text box to "$999.00". The problem is when I run the form the text box displays "$495.00" and not "$49.50" as one would expect. It it shifting the values left here. How do I fix this? Thanks...
0
459
by: james.czebiniak | last post by:
newbie to .net I have a masked textbox intended to display/input salary. The mask is 999,999 or ###,###. When I place the info from the database into the field it formats incorrectly. The salary is 75000. In the textbox it displays 750,00 What am I doing wrong?? ------------------------------------------------------------------------------------ Posted from WWWCoder.com (http://www.wwwcoder.com - The Web Developer's Resource site.
2
1835
by: =?Utf-8?B?QW5kcsOp?= | last post by:
I have a domain www.lomas21.es. That domain is masked forwarded, by the server, to the real stuff at www.solicon.com.es/lomas21/ AJAX is only working: - When you go to www.solicon.com.es/lomas21/ and clicks "Cinturones". AJAX does not work (it rewrites the whole page): - When you go to www.lomas21.es and clicks "Cinturones". It gives only there also a script warning 'Sys' not found.
4
3644
by: Hamayun Khan | last post by:
Hi I have Install Web content extractor on my pc. Web Content Extractor exe has the following path C:\Program Files\Web Content Extractor\WCExtractor.exe Now I used cmd file to initiate Web Content Extractor. I created cmd file and write the following text to file "C:\Program Files\Web Content Extractor\WCExtractor.exe" "D:\ASP.NET\teachnetwork\manager\Scrapfiles\abc-teachers.wcepr" -dr -rt -s -ddr -qe -ex"
0
9511
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
10408
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...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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...
0
6768
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();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
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.