nerdexam
Microsoft

70-515 · Question #169

You are developing an ASP.NET Web page. You add the following markup to the page. <asp:FileUpload id="FileUpload1" runat="server" /> <asp:Button id="btnUpload" Text="Upload selected file"…

The correct answer is A. Replace line 3 with the following code segment. C. Insert the following code segment at line 6. See the full explanation below for the reasoning.

Question

You are developing an ASP.NET Web page. You add the following markup to the page. <asp:FileUpload id="FileUpload1" runat="server" /> <asp:Button id="btnUpload" Text="Upload selected file" OnClick="btnUpload_Click" runat="server" /> <asp:Label id="lblFeedback" runat="server" /> You add the following code segment to the code-behind. (Line numbers are included for reference only.) 01 protected void btnUpload_Click(object sender, EventArgs e) 02 { 03 if (...) 04 { 05 string saveName = Path.Combine(@"c:\uploadedfiles", FileUpload1.FileName); 06 07 lblFeedback.Text = "File successfully uploaded."; 08 } 09 else 10 { 11 lblFeedback.Text = "File upload failed."; 12 } 13 } You need to save the uploaded file and display a message to the user that indicates that the upload either succeeded or failed. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Options

  • AReplace line 3 with the following code segment.
  • BReplace line 3 with the following code segment.
  • CInsert the following code segment at line 6.
  • DInsert the following code segment at line 6.

How the community answered

(29 responses)
  • A
    79% (23)
  • B
    7% (2)
  • D
    14% (4)

Community Discussion

No community discussion yet for this question.

Full 70-515 Practice