Launch Shortcut File

session101

Member
Joined
May 10, 2006
Messages
23
I have a shortcut pointing to an xls file. In my C# application, I need to launch the shortcut with Excel.

I am currently doing this:

string full_path = path;
FileInfo file = new System.IO.FileInfo(full_path);

try
{
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition",
"attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/vnd.ms-excel";
Response.Flush();
Response.WriteFile(file.FullName);
Response.End();
}
}

This fails because the shortcut fails on the file.Exists function. How should I launch the shortcut with Excel?

TIA.
 
PlausiblyDamp said:
Are you returning an excel spreadsheet from a web application or trying to do something else?

Upon clicking a button, I would like to launch a shortcut file that is pointing to an Excel xls sheet.
 
Does the excel file reside on the client or the server? If it is on the server then you will not be able to launch it on the client in this manner. If the file exists on the client I would check that the full_path variable does indeed contain the correct path.
 
Back
Top