473,657 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

storing and accessing file

I have an application that needs to be able to upload documents that can
latter be accessed and opened by a hyperlink. I can do this easliy if I
store the files in a subdirectory in the application, but we will be using
multiple web servers, so the files need to be stored on a common file server.
Saving them is easy enough, but how do I point a hyperlink at a file on a
file server that is different from the web server?

Could you please give me an example of how to do this, and how to set up the
correct permissions on a Windows 2003 server?

Thanks.
Apr 14 '06 #1
3 1442
> I have an application that needs to be able to upload documents that can
latter be accessed and opened by a hyperlink. I can do this easliy if I
store the files in a subdirectory in the application, but we will be using
multiple web servers, so the files need to be stored on a common file server.
Saving them is easy enough, but how do I point a hyperlink at a file on a
file server that is different from the web server?


You probably need to make a page in the application which just
retrieves the content of a specified file, and writes it to the
Response stream [using BinaryWrite or similar]. Then, you would make
your hyperlinks point to this page and pass the name of the required
file in the request string.

For permissions, it depends on your accounts setup. If the files will
be saved/retrieved when the page is accessed anonymously, then you'd
need to give the account under which ASP.NET is running (probably the
IIS default anonymous user account, IUSR_<something >) read/write
permissions on the relevant folders; if they are on a different
machine, then you'd either need to make the ASP service run under a
domain account (so the file servers have access to the credentials) or
explicitly allow the local account on the web server access to the
files on the other servers (which might or might not be possible). If
you pages use an authentication scheme whereby they are running under
the context of the domain account of the user accessing the site, then
if those users have permissions to access the file server anyway, it
should 'just work'. If they do not, you could either grant them
permission, or make the relevant section of code run under an
impersonation context for a domain account that is permission to view
the files.

HTH

-- ph

Apr 15 '06 #2
Hi Gerhard,

You can create a virtual directory in IIS that points to the network path of
the directory on the file server containing the images.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Gerhard" <ac***@communit y.nospam> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I have an application that needs to be able to upload documents that can
latter be accessed and opened by a hyperlink. I can do this easliy if I
store the files in a subdirectory in the application, but we will be using
multiple web servers, so the files need to be stored on a common file
server.
Saving them is easy enough, but how do I point a hyperlink at a file on a
file server that is different from the web server?

Could you please give me an example of how to do this, and how to set up
the
correct permissions on a Windows 2003 server?

Thanks.

Apr 15 '06 #3
Hi Gerhard,

For your scenario, I think you can consider to System.IO class to read the
file stream from the remote file share in the page's code behind file and
then write the stream into the ASP.NET page's ResponseStream to populate
the file download page.

#How To Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
http://support.microsoft.com/kb/306654/en-us

#Downloading Files - Forcing the File Download Dialog
http://aspalliance.com/259

Also, make sure your ASP.NET application can correctly access the remote
server's file share in code.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
=============== =============== =============== =====

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.


Apr 17 '06 #4

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

Similar topics

5
2137
by: Don Vaillancourt | last post by:
I'm building a system when one can upload a document to the website. I will be storing the document on the hard-drive for quick/easy access, but I was also thinking of storing it in an existing database since most of the sites information is all stored there. As well there would be only one place to worry about backing up. And if the file on the hard-drive was ever missing or became corrupted, I could restore it form tha database. Is...
0
1104
by: Sandra | last post by:
I am using a VB6 COM object with an asp.net project. I am storing the COM object in a session variable but am having a problem accessing the COM object from the session variable. I am getting the error: QueryInterface for interface object.class failed I am able to create new instances of the object with no problems but as soon as I cast the session variable to the object like so: CType(Session("object"),object.class)
5
3051
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet explorer would do in this case. The headers I am getting are: Headers {Content-Disposition: attachment; filename="dynamic_file.mdb" Connection: close Cache-Control: private Content-Type: application/octet-stream
0
1056
by: Dave Friedel | last post by:
I read through the WS2 samples but I am still fuzzy on how to access the settings I need to validate my users passwords. Specifically, I do not know how to tell which hostheader is being accessed in the UsernameTokenManager. I typically run many virtual directories where a setting in the Web.Config points to a configuration file on the local server (still paranoid about giving reachable access to a file with passwords etc.) Since many...
9
2366
by: Adam J Knight | last post by:
Hi all, Just wondering whats everyones prefered method of storing images ? 1) File System 2) Database (SqlServer) (Seems to be easier, but has a performance hit) Appreciate some insight!!! Cheers,
6
3190
by: (PeteCresswell) | last post by:
User wants to go this route instead of storing pointers in the DB and the documents outside. Only time I tried it was with only MS Word docs - and that was a loooong time ago - and it seemed to me like there were performance issues at the time. How about the different types? The MS docs I would expect Access to differentiate and handle appropriately (i.e. .DOC and .XLS).. but how about ..PDF? and can I stash a .TXT document in the...
11
2361
by: toton | last post by:
Hi, all of the containers in STL stores object itself (thus copy contsructability & assignability is needed), while NTL or boost ptr_container stores pointer to the object in the container (either exclusively owns, or just stores). Now, my question is for a general guideline when to use which one? What I understand, 1) polymorphic objects need ptr_container. 2) non copy constructable, non assignable objects need ptr_container.
0
2697
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it works for files larger than 8000 Bytes. If a file is less than 1000 Bytes I get the following message: Error message: --invalid input syntax for type oid: "\074\077......";
2
2001
by: Mythran | last post by:
We followed an example found on MSDN to create an encrypted FormsAuthenticationTicket and storing the ticket in a cookie. Is this the "correct" way to store the authentication ticket? We are attempting to create a web service from the web application and our goal is to have the user login to the web application and then, using the same credentials and/or authentication objects, access the web services to retrieve our data from other...
0
8305
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
8825
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
8605
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
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4151
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
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
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.