Hot to get SharePoint Root Site Collection URL using C# in Visual WebPart. I need to access a list in the Root Site Collection not, the current site URL without setting the URL as plain text, How I can do that?
using(SPSite oSite = new SPSite("Root Site Collection")) {
using(SPWeb oWeb = oSite.RootWeb)
{
SPList oList = oWeb.Lists["Employee"];
SPListItem oSPListItem = oList.Items.Add();
oSPListItem["EmployeID"] = txtEmployeeId.Text;
oSPListItem["City"] = txtCity.Text;
oSPListItem.Update();
}
}