Hi,
Here's My Situation:
I have a APS.NET Web Application on .Net 4
Whith An ASPX Page containing the webViewer at the root of the Application
and A .mrt File at Path: [Root]\Report.
I get The Error on report.Load()
Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString.Count != 0)
{
//Getting Parameters and DataSource
StiOptions.Engine.ReportResources.AllowUseResourcesInWeb = true;
this.domainService = new PostLoadDomainService();
if (this.Request.QueryString["PID"] != null)
this.postID = Convert.ToInt32(this.Request.QueryString["PID"]);
Models.AirPostSpec postSpec = domainService.GetAirPostSpecReport(this.postID).SingleOrDefault();
//Loading Report File and DataSource
StiReport report = new StiReport();
string path = Server.MapPath("Report/AirPostSpec.mrt");
//path = ''E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\Report\AirPostSpec.mrt"
report.RegData("DS", postSpec);
report.Load(path);
StiWebViewer1.Report = report;
}
}
-----------------------------------------------------------------------------------------------------------------------------------
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StmRptViewer.aspx.cs" Inherits="PostLoad.Web.StmRptViewer" %>
<%@ Register Assembly="Stimulsoft.Report.Web, Version=2012.2.1304.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"
Namespace="Stimulsoft.Report.Web" TagPrefix="cc1" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<cc1:StiWebViewer ID="StiWebViewer1" runat="server"
DropDownMenuFontFamily="Tahoma" />
</div>
</form>
</body>
------------------------------------------------------------------------------------------------------------------------------------------------------
Error:
Server Error in '/' Application.
Could not find a part of the path 'E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\Report\AirPostSpec.mrt'.
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: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\Report\AirPostSpec.mrt'.
Source Error:
Line 61: string path = Server.MapPath("Report/AirPostSpec.mrt");
Line 62: report.RegData("DS", postSpec);
Line 63: report.Load(path);
Line 64: StiWebViewer1.Report = report;
Line 65: }
Source File: E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\StmRptViewer.aspx.cs Line: 63
Stack Trace:
[DirectoryNotFoundException: Could not find a part of the path 'E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\Report\AirPostSpec.mrt'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +224
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1352
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +66
Stimulsoft.Report.StiReport.Load(String path) +224
PostLoad.Web.StmRptViewer.AirPostSpec() in E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\StmRptViewer.aspx.cs:63
PostLoad.Web.StmRptViewer.Page_Load(Object sender, EventArgs e) in E:\Projects\PostLoad\Code\Version 1.1.0.0\PostLoad\PostLoad.Web\StmRptViewer.aspx.cs:49
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
--------------------------------------------------------------------------------------------------------------------------------------------------------
Hope this is enough!
PS: I did some checking and I found that the error happens when the path is long, when I put the .mrt file in a location that has a short path the error does not happen.
Thank you for your replay!