nerdexam
Microsoft

70-573 · Question #28

70-573 Question #28: Real Exam Question with Answer & Explanation

The correct answer is A. Run the code segment at line 09 inside a RunWithElevatedPrivileges delegate.. MNEMONIC RULE: "RunWithElevatedPrivileges" SPSecurity.RunWithElevatedPrivileges Method us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

Question

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?

Options

  • ARun the code segment at line 09 inside a RunWithElevatedPrivileges delegate.
  • BAdd the following code at line 08:
  • CAdd the following code at line 08:
  • DChange line 09 to the following code segment:

Explanation

MNEMONIC RULE: "RunWithElevatedPrivileges" SPSecurity.RunWithElevatedPrivileges Method us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice