I want to access SPWeb object in feature under its FeatureActivated method. There are two ways to do this:
Public Override void FeatureActivated(SPFeatureReceiverProperties properties) {
//Method 1
SPWeb web = properties.Feature.Parent as SPWeb;
//Method 2
SPSite site = new SPSite("http://merdev-moss:5050");
SPWeb web = site.OpenWeb();
}
Whats the differencce between two methods ? Which one is best under which scenario ?