Microsoft
70-573 · Question #152
70-573 Question #152: Real Exam Question with Answer & Explanation
Sign in or unlock 70-573 to reveal the answer and full explanation for question #152. The question stem and answer options stay visible for context.
Question
You create a Web Part that takes three values from three text boxes and creates a new SharePoint site when you click a button named CreateNewSite. The Web Part contains the following code segment. Protected Sub CreateNewSite_Click(ByVal sender As Object, ByVal e As EventArgs) Dim site As SPSite = SPContext.Current.Site Dim web As SPWeb = site.AllWebs.Add(SiteNameTextBox.Text, SiteTitleTextBox.Text, SiteDescriptionTextBox.Text, 0, SPWebTemplate.WebTemplateSTS, False, _False) End Sub You test the Web Part and it works properly. When another user attempts to use the Web Part to create a new site, he receives the following error message: "Error: Access Denied." You need to ensure that users can use the Web Part to create new sites. What should you do?
Options
- AAdd web.Update() after the code segment.
- BAdd web.ValidatesFormDigest() after the code segment.
- CRun the code segment inside a SPSecurity.
- DAdd the following code after the code segment.
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.