Tuesday, 12 August 2014

Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\


How to get rid from the error "Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\"?

this error is usually coz for .net server a path in a form of string is not enough you have to specify thats you are accessing it from your own server ,you have to tell server that "YES!its a directory of my own server" by implementing Server.MapPath() method.

Lets see how it goes....as i want one of my directory to be removed i am using below code

----------------------------------------------------------------------------------------------------------------

string path="Reports/NK/MyDirectory";//path as a string
          
Directory.Delete(path, true);//wrong way hence shows error

Directory.Delete(Server.MapPath(path), true);//right way as he know its a directory in your own server

---------------------------------------------------------------------------------------------------------------

let me know if you still find any issue.

No comments:

Post a Comment

Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...