Hi,
i am trying to get the SPWeb object,
i can get it using the Site:
- Statically
using (SPSite site = new SPSite("http://url/"))
{
using (SPWeb web = site.OpenWeb("NameOfSubSite"))
{
.....
}
}
but using this way i should enter the URL of site when get the SPSite and the name of subsite when get SPWeb usingsite.OpenWeb
- Dynamically
by use the SPContext: SPWeb web = SPContext.Current.Web;
here i can get the current web without enter the URL of site nor the name of subsite
the question is what is the best way to get the web of current site, and what is the difference between the 2 ways.
Thank you
Regards