session101 Posted June 14, 2006 Posted June 14, 2006 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. Quote
Administrators PlausiblyDamp Posted June 18, 2006 Administrators Posted June 18, 2006 Are you returning an excel spreadsheet from a web application or trying to do something else? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
session101 Posted June 19, 2006 Author Posted June 19, 2006 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. Quote
Administrators PlausiblyDamp Posted June 26, 2006 Administrators Posted June 26, 2006 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
session101 Posted June 26, 2006 Author Posted June 26, 2006 The file is on a shareable folder of a server. What is the best way to launch it? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.