0

I am new with asp.net MVC5, i'm using entity Framework code first. In my controller i have already created folder with Crystal reporting tool and Dataset to get the data with parameter

 // GET: Contact
    public async Task<ActionResult> Index()
    {
        var Contact = db.Contact.Include(s => s.customer);
        return View(await Contact.ToListAsync());
    }


    // GET: Contact/Report/5
    public async Task<ActionResult> ExportReport(int? id)
    {
        if (id == null)
        {
            return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        }
        Contact Contact = await db.Contact.FindAsync(id);
        ReportDocument rd = new ReportDocument();
        rd.Load(Path.Combine(Server.MapPath("~/Report"), "CrystalReport1.rpt"));
        rd.SetDataSource(Contact);
        Response.Buffer = false;
        Response.ClearContent();
        Response.ClearHeaders();

        try
        {
            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            stream.Seek(0, SeekOrigin.Begin);
            return File(stream, "application/pdf", "Contact.pdf");
        }
        catch { throw; }


    }

Can any one help me why i got this error?

HTTP Error 400.0 - Bad Request Unzulässige Anforderung Detailed Error Information: Module ManagedPipelineHandler Notification ExecuteRequestHandler Handler System.Web.Mvc.MvcHandler Error Code 0x00000000

thanks

John
  • 75
  • 1
  • 10

0 Answers0