Click here to Skip to main content
15,886,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

I want to open a Excel file from my local path using MVC. I created View and passing required parameters to controller using $.post

I am able to locate file in action method of controller however I am not sure on how to open the file in client side 
with OPEN/SAVE/SAVE AS options. Kindly let me know how to extract the file and give those options to the users.

Many thanks in advance.

What I have tried:

<pre>I tried 
===============
Controller :- I mapped destination folder

View :- $.post("@url.Action("View","EMP")",{......}, etc....
Posted
Updated 9-Dec-20 23:52pm

1 solution

You can't open a file in the client side from the server because you have no access to the client file system - for security reasons. All you can do is get the user to upload the file to the server, but then it's not going to open in a way that he can see.

You can't cause a file to be opened in the client side from the server for the same reasons.

You can't open a client file from the client browser for ... you guessed it, security reasons.

Basically, you cannot do what you want to.
 
Share this answer
 

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