Reputation: 5220
I'd like to redirect the user to a directory on a file server using its UNC path. I've tried using something like the following but I just get a 404 error.
Response.Redirect(@"file:\\fileserver\data\");
What's the correct syntax to make this work?
Upvotes: 0
Views: 5213
Reputation: 45392
file:////server/directory
Or, create a virtual directory in your Website and map it to a path, like /data/
Upvotes: 0
Reputation: 7830
You don't quite have the file protocol identifier correct. Try:
string location = String.Format("file:///{0}", @"\\fileserver\data\");
Response.Redirect(location, true);
Upvotes: 3
Reputation: 40245
I'm not sure about the Response.Redirect
method, but you can always write the file for download by the user using Response.WriteFile
.
This link might help: http://support.microsoft.com/kb/307603/EN-US/
Code Snippet from above link:
private void Page_Load(object sender, EventArgs e)
{
//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Write the file directly to the HTTP output stream.
Response.WriteFile(@"\\server\folder\file.pdf");
Response.End();
}
Upvotes: 0