ReportViewer Control problem

N

nitadmin

Hi,


I created a new aspx page and I added the Report Viewer Control.
I am using Visual Studio 2005, >Net Framework 2.0
I have already published report on my Report Server.
My report server is running on a Windows 2003 server, running SQL 2005
and Report Services 2005.


When I access the webpage from Internet Explorer, I keep getting this
exception.

In remote mode, the Report Viewer control requires session state be
enabled or Report Server connection information specified in the
config file.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details:
Microsoft.Reporting.WebForms.MissingReportServerConnectionInformationException:
In remote mode, the Report Viewer control requires session state be
enabled or Report Server connection information specified in the
config file.




Why does this happen? What am I doing wrong?
Is my code behind correct? Is my web.config file correct?

thanks,
nitadmin


Here is the source fro my aspx file.

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="LabResultReport.aspx.cs" Inherits="LabResultReport" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms,
Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Button" />&nbsp;
<rsweb:ReportViewer ID="rpvResult" runat="server" Font-
Names="Verdana" Font-Size="8pt" Height="400px" ProcessingMode="Remote"
Width="400px">
<ServerReport ReportPath="/CPOEReports/LabResults"
ReportServerUrl="http://sqlserver/ReportServer" />
</rsweb:ReportViewer>

</div>
</form>
</body>
</html>


Here is C# code for the codebehind file.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Reporting.WebForms;

public partial class LabResultReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

private void DisplayLabResultReport()
{
string strOrderID="";
if(Request.QueryString["OrderID"]!=null )
{
strOrderID = Request.QueryString["OrderID"].ToString();
ReportParameter[] parm = new ReportParameter[1];
parm[0] = new ReportParameter("OrderID", strOrderID);
rpvResult.ShowCredentialPrompts = false;

rpvResult.ServerReport.ReportServerCredentials = new
ReportCredentials("myusername", "mypassword", "mydomain");
rpvResult.ProcessingMode =
Microsoft.Reporting.WebForms.ProcessingMode.Remote;

rpvResult.ServerReport.ReportServerUrl = new System.Uri
("http://sqlserver/ReportServer");
rpvResult.ServerReport.ReportPath = "/CPOEReports/
LabResults";
rpvResult.ServerReport.SetParameters(parm);
rpvResult.ServerReport.Refresh();


}
}
protected void Button1_Click(object sender, EventArgs e)
{
DisplayLabResultReport();
}
}


public class ReportCredentials :
Microsoft.Reporting.WebForms.IReportServerCredentials
{

string _userName, _password, _domain;

public ReportCredentials(string userName, string password, string
domain)
{

_userName = userName;

_password = password;

_domain = domain;

}

public System.Security.Principal.WindowsIdentity ImpersonationUser
{

get
{

return null;

}

}



public System.Net.ICredentials NetworkCredentials
{

get
{

return new System.Net.NetworkCredential(_userName,
_password, _domain);

}

}



public bool GetFormsCredentials(out System.Net.Cookie authCoki,
out string userName, out string password, out string authority)
{

userName = _userName;

password = _password;

authority = _domain;

authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH",
"/", "Domain");

return true;

}

}


Here is the web.config file


<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting"
type="System.Web.Configuration.ScriptingSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" allowDefinition="Everywhere"/>
<section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
allowDefinition="MachineToApplication"/>
<section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<system.web>

<httpModules>
<clear/>
</httpModules>

<customErrors mode="Off"/>

<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider,
Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>

<authentication mode="None"/>

<httpHandlers>
<remove path="*.asmx" verb="*" />
<add path="*.asmx" verb="*"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
validate="false" />
<add path="*_AppService.axd" verb="*"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
validate="false" />
<add path="ScriptResource.axd" verb="GET,HEAD"
type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
validate="false" />
<add path="Reserved.ReportViewerWebControl.axd" verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler,
Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<!--
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
-->
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/ </modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx"
preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*"
path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode"
verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top