467,923 Members | 1,372 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

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
  • viewed: 1178
Share:
3 Replies
> 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***@community.nospam> wrote in message
news:9C**********************************@microsof t.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sandra | last post: by
5 posts views Thread by Daniel Corbett | last post: by
reply views Thread by Dave Friedel | last post: by
9 posts views Thread by Adam J Knight | last post: by
11 posts views Thread by toton | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.