title: instantiate SPSite and SPWeb objects
body: <p>I want to know whats the best method of Instantiating SPSite and SPWeb objects . As there are no. of ways by which you can do this.Some of the ways I know</p>
  
  <pre><code>1. 
  SPSite mySite = SPControl.GetContextSite(Context);
              SPWeb myWeb = SPControl.GetContextWeb(Context);
  </code></pre>
  
  <p>//Why we use second method as in first method there is no need to write the hardcoded url and also no need to dispose too as recommended by Microsoft.</p>
  
  <pre><code>2. 
  SPSite mySite=new SPSite("http://abc");
  SPWeb myweb= mySite.RootWeb;
  //Dispose
  mySite.Dispose();
  myweb.Dispose();
  
    or difff. way of disposing for it by having using( )
  </code></pre>
  
  <p>/</p>
  
  <pre><code>   3. Similar to first.. SPSite mySite = SPContext.Current.Site;
                           SPWeb myweb = SPContext.Current.Web;
  </code></pre>
  
  <p>Let me know if there is any other best approach or means out of these which should be the best approach to instantiate objects.....</p>
  
  <p>Thanks,</p>