I need to get 14 hive path using code in C#.net.
can any one tell me how can I do this?
You can access the physical path using SPUtility
- the web path by looking at the SPWeb
object.
Using SPUtility
to get the SetupPath of Sharepoint like so:
using Microsoft.SharePoint.Utilities;
string spSetupPath = SPUtility.GetGenericSetupPath(string.Empty);
//e.g. returns "C:\Program Files\Common files\Microsoft Shared\Web Server Extensions\14
Or you can use SPWeb's server relative URL method:
using Microsoft.Sharepoint;
string spServerURL = SPWeb.ServerRelativeUrl;
MSDN documentation SPWeb.ServerRelativeURL
Also have an overview of the Sharepoint 2010 14 hive structure.