I was trying to Export to Excel in ASP.NET MVC, but I got this error

Why am I seeing this error and how do I resolve the problem.
See my code as attached.

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ankit SharmaRank #141 · 16.1K reputationPosted Dec 20, 2017, 2:34 AM EST
mike idowuRank #4,104 · 365 reputationPosted Dec 20, 2017, 2:47 AM EST
Ankit SharmaRank #141 · 16.1K reputationPosted Dec 20, 2017, 2:54 AM EST