Access Network through asp.net 2.0 application
-
hi guys! need some help. i need to access files from my local network through an Asp.net Application on win2k3 IIS 6. i tried to open the file through filestream but it gives an Access Denied error . i tried this:
string ActualPath = "\\\\192.168.0.26\\c$\program files\abc\abc.exe" FileStream file = new FileStream(ActualPath, FileMode.Open, FileAccess.Read);
but it thows an unauthroized access exception.. but when i try to run this code on XP with iis 5 . it works fine . cant figure it out wtz the problem.abhinav
-
hi guys! need some help. i need to access files from my local network through an Asp.net Application on win2k3 IIS 6. i tried to open the file through filestream but it gives an Access Denied error . i tried this:
string ActualPath = "\\\\192.168.0.26\\c$\program files\abc\abc.exe" FileStream file = new FileStream(ActualPath, FileMode.Open, FileAccess.Read);
but it thows an unauthroized access exception.. but when i try to run this code on XP with iis 5 . it works fine . cant figure it out wtz the problem.abhinav
The cause is that IIS 6 is more secure (relatively) and won't allow access like this. You could play around with impersonation however in the end it is not a good idea to allow access to files or application through a webpage. There has been a great deal of effort to lock down and protect systems from hacks, viruses and miscredents.
only two letters away from being an asset