I am exporting an excel using c# code and spreadsheetlight dll. I am trying to insert a picture into excel, everything works well on local machine but on live web site it gives following error
Access to the path 'F:\sitesroot\0\Images\Logo.png' is denied
My c# code.
string filePath = Server.MapPath("~/Images/Logo.png");
SLPicture pic = new SLPicture(filePath); //SLPicture - An inbuilt class for inserting image
Currently what I am doing is manually providing access rights on IIS server but which is not the correct way to go since each time I upload the service I have to redo that again and again
Any expert advice - How I can provide access right through code? Or How to get rid of this error.
Thanks.
Assuming you are using Cloud services...
You are supposed to use Local Storage for this ( http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx ).
Basically;
RoleEnvironment.GetLocalResource("foo")
to get the folder name you can use and then do something like Path.Combine("path","Logo.png")
to get a file name which you can then write to.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.