About Process.Start

see07

Regular
Joined
Apr 16, 2004
Messages
78
Location
Mexico City
Hello I have a web form project in which I need to open an .xls file, I have this code:

string sysFolder = @"C:";
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.FileName = sysFolder + @"\\tjcr.xls";
pInfo.UseShellExecute = true;
Process p = Process.Start(pInfo);

When last code line is executed, system remains as it was executing something (a glass hour is shown) but it may remain there for hours not showing Excel sheet.

If I place this same code into a project using Windows Form is working OK.

My questions are: It’s not possible use this code in a Web Form? What if I need to do it in a web form?

I’ll appreciate your comments.
A.L.
 
Running the above code in ASP.Net will cause Excel to be executed on the server (where it cannot be seen) rather than the client. If you want the worksheet to be opened on the client you will need to provide a link to the sheet so the user is prompted to save / open the document.
 
Last edited:
Back
Top