Microsoft
70-573 · Question #40
70-573 Question #40: Real Exam Question with Answer & Explanation
Sign in or unlock 70-573 to reveal the answer and full explanation for question #40. The question stem and answer options stay visible for context.
Question
You create a Web Part that queries a list. The Web Part contains the following code segment. (Line numbers are included for reference only.) 01 protected override void Render( HtmlTextWriter writer) 02 { 03 SPUserToken spInToken = GetTheContext ( SPContext.Current.Site ) ; 04 using (SPSite aSite = nera SPSite ( curSiteCtx.ID , spInToken ) ) 05 { 06 07 } 08 } 09 private SPUserToken GetTheContext ( SPSite nUeb ) 10 < 11 nWeb.CatchAccessDeniedException = false; 12 SPUserToken spToken = null; 13 try 14 { 15 spToken = nWeb.SystemAccount.UserToken ; 16 } 17 catch ( UnauthorizedAccessException ) 18 { 19 20 } 21 return spToken; 22 } You need to ensure that users without permissions to the list can view the contents of the list from the Web Part. Which code segment should you add at line 19?
Options
- ASPSecurity.RunWithElevatedPrivileges(delegate()
- BSPSecurity.RunWithElevatedPrivileges(delegate()
- CspToken = nWeb.RootWeb.AllUsers[SPContext.Current.Web.Name].UserToken;
- DspToken =
Unlock 70-573 to see the answer
You've previewed enough free 70-573 questions. Unlock 70-573 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.