- Also when you use following snippet it will not dispose SPSite object:
Here SPSite object is not disposed so follow below style in case of such scenerios:
using(SPSite oSite=new SPSite("url"))
This will solve the problem of disposing.
- Do not use "Using" when you work with SPContext. As SPContext are disposed automatically and if you use withing Using block than it will dispose SPWeb object and page will not work.