?
Solved

Virual Directory to Retrieve files in another Hard Disk of a computer

Posted on 2005-03-03
8
Medium Priority
?
196 Views
Last Modified: 2013-11-13
Good Day Experts,

I would just like to know if it is safe to point a link of a virtual directory in IIS.

Say I have a website running in ASP.NET codebehind VB.NET and say that this is the link

https:\\www.domain.com\virtualdirectory\index.aspx

- The virtualdirectory is one of the websites created in IIS.
- INside the index.aspx is a DataGrid that holds information and one of these information is a link of a audio file that they an download.
- The file that they are trying to download isn't in IIS its on another HARD Disk but on the same computer say D:Drive.
- I created a new Virtual Directory which points to this Drive(D).
- THe link I was talking about contains a link pointing to this Vitrual Directory.
- Same Link would be "http:\\www.domain.com\VitualDriveD\filename
- So as you can see the URL is exposed and even though I have a login page where they can authenticate themselves if they know the URL they can just go and download it directly... IF THEY KNOW THE URL.

MY QUESTION IS... IS THERE A BETTER WAY OR DO i just need to change something in what I am doing.


Thanks In Advance GUYS and GALS...

vncmrc12
0
Comment
Question by:vncmrc12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 1

Expert Comment

by:kocherga
ID: 13459908
Please explain what is your problem. What are you trying to do? You want the users to be able to download a file by clicking a link. But you do not want them to do the same without clicking the link, right? Does that describe your problem?
0
 
LVL 3

Author Comment

by:vncmrc12
ID: 13461270
kocherga,

Well something like that. I have been seing in some website that uses ASP.NET when you click a hyperlink it shows a http:\\www.domain.com\?>.......

THis is a link but it actually a link that has been redirected so when you try to just cut and paste them into a new IE windows it  wo=nt get through or execute.

My question is that how can I do that... Thank.. hope this helps......

vince12
0
 
LVL 1

Expert Comment

by:kocherga
ID: 13462615
Your link can point to an asp page in the same virtual directory.

The page would check referral header and if necessary cookies.
If everything is ok, it will execute these 2 lines:

Response.ContentType = "audio/wav" 'or whatever the type is
Server.Transfer(your file path)

The file can be in a directory under the same virtual directory and that directory may be configured inaccessible from outside.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:vncmrc12
ID: 13463522
kocherga,

-Currently for example I have my website's url at www.vncmrc12.com\datagridexample.aspx.

- Inside this datagrid contains a link inside my website.

- THis link is directed to a virtual directory which you showed me how to do.

- You said that the page would check referral header from another page?

- Can you show me code.... anything would be much appreciated... thank you...

- I also have a ASP.NET book with me, what topic is this in ASP.NET. Is it the State Management topic... thanks again
 
0
 
LVL 1

Expert Comment

by:kocherga
ID: 13464728
No, referrer header has nothing to do with state management.
Check Request object, ServerVariables property.

You have to check this expression:

Request.ServerVariables("HTTP_REFERER")
(Yes, it is misspelled).

You check whether it is the URL of your page with the link.
If it is blank then the URL was entered directly.
0
 
LVL 3

Author Comment

by:vncmrc12
ID: 13478632
kocherga,

Thanks for that tip.

-Okay so far this is what I have been doing. I have 2 webpages namely page1.aspx and page2.aspx.
-page1.aspx has a link going to pag2.aspx.
-2 I have created a hidden label and place the code lblVariable.Text = Request.ServerVariables("HTTP_REFERER").
- It shows on the label the previous website I came from.
- but when I try to click the link to download an audio in page2 it still shows the complete url of the link. So even though the user don't go into my website and just remembers the URL he/she can download this audio file. Any ideas...
- I am currently experementing on the ?filename=&foldername=, I believe these are the Request.QueryStrings.... do you have any ides on how can I do this...

vncmrc12

PS. Thank again.
0
 
LVL 1

Accepted Solution

by:
kocherga earned 1500 total points
ID: 13483096
1. You do not need a label.
2. "It shows the URL" is not the same as "the user can download the file".

You have to put something like this:
if Request.ServerVariables("HTTP_REFERER")="http://vncmrc12.com/page1.aspx"
Response.ContentType = "audio/wav" 'or whatever the type is
Server.Transfer(your file path)
end if

If you go to page2 by clicking the link the condition in IF will be true. If not (the URL entered into the location bar) the condition will be false and the file will not be downloaded.
0
 
LVL 3

Author Comment

by:vncmrc12
ID: 13484879
kocherga,

Got it.... saved me alot of sleepless night....

vncmrc12
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question