Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. load report gives an error

load report gives an error

Scheduled Pinned Locked Moved ASP.NET
questionhtmlcssasp-netdesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kripa21
    wrote on last edited by
    #1

    I want to add 1 crystal report on my form But following code gives me error for load report How can I solve this? testRpt.aspx

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="testRpt.aspx.vb" Inherits="Booking_Final_Booking_testRpt" %>

    <%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
    rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <CR:CrystalReportViewer ID="CrystalReportViewer1"
    runat="server" AutoDataBind="True"
    Height="1039px"
    ReportSourceID="CrystalReportSource1"
    Width="901px" />
    <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
    <Report FileName="CrystalReport1.rpt">
    </Report>
    </CR:CrystalReportSource>

    </div>
    </form>
    

    </body>
    </html>

    testRpt.aspx.vb

    Imports Crystaldecisions.crystalreports.engine
    Imports Crystaldecisions.reportsource
    Imports Crystaldecisions.shared
    Imports Crystaldecisions.windows.forms
    Imports System.Data.SqlClient

    Partial Class testRpt
    Inherits System.Web.UI.Page

    Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim crystalReport As New ReportDocument()
        crystalReport.Load(Server.MapPath("CrystalReport1.rpt"))
        crystalReport.SetDatabaseLogon("sa", "")
        CrystalReportViewer1.ReportSource = crystalReport
    

    end sub
    end Class

    and error is as

    Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    A 1 Reply Last reply
    0
    • K kripa21

      I want to add 1 crystal report on my form But following code gives me error for load report How can I solve this? testRpt.aspx

      <%@ Page Language="VB" AutoEventWireup="false" CodeFile="testRpt.aspx.vb" Inherits="Booking_Final_Booking_testRpt" %>

      <%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
      Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml" >
      <head runat="server">
      <title>Untitled Page</title>
      <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
      rel="stylesheet" type="text/css" />
      </head>
      <body>
      <form id="form1" runat="server">
      <div>
      <CR:CrystalReportViewer ID="CrystalReportViewer1"
      runat="server" AutoDataBind="True"
      Height="1039px"
      ReportSourceID="CrystalReportSource1"
      Width="901px" />
      <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
      <Report FileName="CrystalReport1.rpt">
      </Report>
      </CR:CrystalReportSource>

      </div>
      </form>
      

      </body>
      </html>

      testRpt.aspx.vb

      Imports Crystaldecisions.crystalreports.engine
      Imports Crystaldecisions.reportsource
      Imports Crystaldecisions.shared
      Imports Crystaldecisions.windows.forms
      Imports System.Data.SqlClient

      Partial Class testRpt
      Inherits System.Web.UI.Page

      Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          Dim crystalReport As New ReportDocument()
          crystalReport.Load(Server.MapPath("CrystalReport1.rpt"))
          crystalReport.SetDatabaseLogon("sa", "")
          CrystalReportViewer1.ReportSource = crystalReport
      

      end sub
      end Class

      and error is as

      Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Add this line in Web.config <trust level="Full" originUrl="" /> You might find interest to read one article on Trust level Here. [^] Hope you like this solution. Cheers. :rose:

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      K 1 Reply Last reply
      0
      • A Abhishek Sur

        Add this line in Web.config <trust level="Full" originUrl="" /> You might find interest to read one article on Trust level Here. [^] Hope you like this solution. Cheers. :rose:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        K Offline
        K Offline
        kripa21
        wrote on last edited by
        #3

        Mr Abhishek, I added in web.config bt still having problem

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups