exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 24 discussion

Actual exam question from Microsoft's 70-486
Question #: 24
Topic #: 1
[All 70-486 Questions]

HOTSPOT -
You are developing an ASP.NET MVC web application that enables users to open Microsoft Excel files.
The current implementation of the ExcelResult class is as follows.

You need to enable users to open Excel files.
How should you implement the ExecuteResult method? (To answer, select the appropriate options in the answer area.)
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Target 1:

Name: AcceptTypes -
Synopsis: stringArray = Request.AcceptTypes
Returns a String array containing theMultipurpose Internet Mail Extension (MIME) types accepted by the client. You can use this property to determine whether a client can accept certain response types, including application types such as Word or Excel, which are supported only by Internet Explorer.
Target 2, Target 3:
Example: Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); Response.ContentType = "application/ms-excel";
Reference: Export data to Excel file with ASP.NET MVC 4 C# is rendering into view http://stackoverflow.com/questions/16346227/export-data-to-excel-file-with-asp-net-mvc-4-c-sharp-is-rendering-into-view

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
apostolin
Highly Voted 5 years, 7 months ago
The correct answer is: var canProcess = request.AcceptTypes.Contains("application/vnd.ms-excel"); response.AddHeader("content-disposition", "attachment; filename=dl"); response.ContentType = "application/ms-excel";
upvoted 8 times
...
hungry_ape9000
Most Recent 4 years, 12 months ago
FINAL ANSWER: var canProcess = request.AcceptTypes.Contains("application/vnd.ms-excel"); response.AddHeader("content-disposition", "attachment; filename=dl"); response.ContentType = "application/ms-excel";
upvoted 4 times
...
Khanyie
5 years, 5 months ago
The Correct answer for the first bar is the second option
upvoted 1 times
gow
5 years, 3 months ago
Its request.AcceptTypes.Contains("application/vnd.ms-excel") Reference: https://docs.microsoft.com/en-us/dotnet/api/system.web.httprequest.contenttype?view=netframework-4.8
upvoted 1 times
LAV
5 years, 2 months ago
HttpRequest.AcceptTypes return string array (Ref.:https://docs.microsoft.com/ru-ru/dotnet/api/system.web.httprequest.accepttypes?view=netframework-4.8). String array does not have a method "Contains", therefore for the first bar correct answer is second option.
upvoted 1 times
MaMa12345
5 years, 2 months ago
String arrays have a .Contains("..") method if LinQ is used: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.contains?view=netframework-4.8 As usual the question doesn't display the using statements so we can't see it.
upvoted 1 times
...
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago