Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

security - Getting System.UnauthorizedAccessException while trying to write to a file from the web service -


my code:

[webmethod]         public string helloworld()         {             string path = @"d:\data\wwwroot\myservice\myservice\log.txt";             if (file.exists(path))             {                 using (streamwriter sw = new streamwriter(path))                 {                     sw.write("some sample text file");                     return "wrote file";                 }             }             else             {                 return "file doesnt exist";             }          } 

what getting is: system.unauthorizedaccessexception: access path 'd:\data\wwwroot\myservice\myservice\log.txt' denied. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.filestream.init(string path, filemode mode, fileaccess access, int32 rights, boolean userights, fileshare share, int32 buffersize, fileoptions options, security_attributes secattrs, string msgpath, boolean bfromproxy) @ system.io.filestream..ctor(string path, filemode mode, fileaccess access, fileshare share, int32 buffersize, fileoptions options) @ system.io.streamwriter.createfile(string path, boolean append) @ system.io.streamwriter..ctor(string path, boolean append, encoding encoding, int32 buffersize) @ system.io.streamwriter..ctor(string path) @ linktagoutwebservice.service1.helloworld() in d:\data\wwwroot\myservice\myservice\service.asmx.cs:line 29

any security settings need? log file set red/write....

issue solved, permissions issue. have grant iis user app running under permission write file.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -