You need to modify the Web Part to prevent the site from loading slowly

You have a Web Part that contains the following code segment. (Line numbers are included for
reference only.) 01Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 02
Dim site As New SPSite(“http://www.contoso.com/default.aspx”) 03 If True Then 04 Dim web As
SPWeb = site.OpenWeb() 05 06 End If 07End Sub You deploy the Web Part to a SharePoint site.
After you deploy the Web Part, users report that the site loads slowly. You need to modify the
Web Part to prevent the site from loading slowly. What should you do?

You have a Web Part that contains the following code segment. (Line numbers are included for
reference only.) 01Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 02
Dim site As New SPSite(“http://www.contoso.com/default.aspx”) 03 If True Then 04 Dim web As
SPWeb = site.OpenWeb() 05 06 End If 07End Sub You deploy the Web Part to a SharePoint site.
After you deploy the Web Part, users report that the site loads slowly. You need to modify the
Web Part to prevent the site from loading slowly. What should you do?

A.
Add the following line of code at line 05. web.Close()

B.
Add the following line of code at line 05. web.Dispose()

C.
Add the following line of code at line 05. site.Close()

D.
Change line 02 to the following code segment. Using site As New
SPSite(“http://www.contoso.com/default.aspx”)



Leave a Reply 0

Your email address will not be published. Required fields are marked *