PrepAway - Latest Free Exam Questions & Answers

You need to resolve the error

You create a Web Part that contains the following logging code. (Line numbers are included for
reference only.) 01 SPWeb web = SPContext.Current.Web; 02 try 03 { 04 05 } 06 catch
(Exception ex) 07 { 08 09 System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, (“Exception
Information: ” + ex.Message), EventLogEntryType.Error); 10 } You discover that line 09 causes an
error. You need to resolve the error. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Run the code segment at line 09 inside a RunWithElevatedPrivileges delegate.

B.
Add the following code at line 08: if (web.CurrentUser.IsSiteAuditor == false)

C.
Add the following code at line 08: if (web.CurrentUser.IsSiteAdmin == false)

D.
Change line 09 to the following code segment:
System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, “Exception Information”,
EventLogEntryType.Error);

Explanation:


Leave a Reply