Click here to Skip to main content
15,906,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends

anyone can tell me how open excel file in asp.net linkbutton on iis server.

actually i made a project when we click linkbutton excel file will be open i write a coding in linkbutton

System.Diagonostics.Process.Start("excelfile Path");


But when my web site run on IIS server it will not work wht should i do.pls give me the proper step to open excel file on linkbutton only..

send a proper coding...
Posted
Updated 25-Apr-10 18:45pm
v2

You should do some googling in place of asking PROPER CODE. Better if you do some R&D from your side and if you are fail then you can ask for help within your code.
 
Share this answer
 
System.Diagonostics.Process.Start("excelfile Path");

this will not work for ASP.NET

Try following code.

Response.Writefile(filePath);//Relative file path 
Response.ContentType = "application/x-excel";


Response.AddHeader("content-disposition", "inline; filename=\"" + YourSuggestedFileName + "\"");
 
Share this answer
 
Comments
Mohit3 2-Apr-11 3:55am    
Thankyou so much sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900