Crystal Report Image Issue - asp.net

Crystal Report......Web Application MVC
I am trying to get Image to displayed.
Logo of company instead it is showing image alt="Image". By checking inspecting element I came to know that the src="CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_d6cbdac3-0385-4ffd-a368-5a514303cb66.png"
. I tried hard to get it rectified by searching on many sites but could get...
any one who know this issue...
Thanks

Hi I have struggled with similar issue for quite some time.
I hope this solution might help you.
Web Config Changes:
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
</httpHandlers>
<handlers>
<remove name="CrystalImageHandler.aspx_GET" />
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" preCondition="integratedMode"/>
</handlers>
Note*: Handler Path field didn't had ".aspx" extension.
Add this block of code to you global.asax.cs
protected void Application_BeginRequest(object sender, EventArgs e)
{
var p = Request.Path.ToLower().Trim();
if (p.EndsWith("/crystalimagehandler.aspx") && p != "/crystalimagehandler.aspx")
{
var fullPath = Request.Url.AbsoluteUri.ToLower();
var NewURL = fullPath.Replace(".aspx", "");
Response.Redirect(NewURL);
}
}
This would Help you to resolve the issue.

Related

body of report not visible

Using Visual Studio 2015 mvc 5 application. I have created an SSRS report with Visual Studio 2012 that does not take any parameters (yet). I used nuget to add ReportViewerForMvc. I went through an online tutorial to create ReportTemplate.aspx etc. I'm using Forms Authentication so I changed my data sources to use a static SQL Login in SSRS. When I run the report manually I get 151 pages. When I run it through the application the toolbar at the top reads 1 of 151 pages. However, I can't see the body of the report and all the buttons on the toolbar are disabled. I've been fiddling with the control properties in the ReportTemplate.aspx.cs (code behind) and the ReportTemplate.aspx but nothing seems to change it.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportFolder"].ToString();
String reportUri = System.Configuration.ConfigurationManager.AppSettings["SSRSReportUri"].ToString();
rvSiteMapping.Height = Unit.Pixel(2000);
rvSiteMapping.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
rvSiteMapping.ServerReport.ReportServerUrl = new Uri(reportUri); // Add the Reporting Server URL
rvSiteMapping.ServerReport.ReportPath = String.Format("/{0}/{1}", reportFolder, Request["ReportName"].ToString());
rvSiteMapping.ServerReport.Timeout = 320000;
rvSiteMapping.ServerReport.Refresh();
rvSiteMapping.ShowReportBody = true;
rvSiteMapping.ShowToolBar = true;
rvSiteMapping.SizeToReportContent = true;
rvSiteMapping.Enabled = true;
rvSiteMapping.Visible = true;
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
}
}
Package Entries:
<package id="MicosoftReportViewerWebForms_v11" version="1.0.1" targetFramework="net451" />
<package id="ReportViewerForMvc" version="1.0.0" targetFramework="net451" />
Web.Config:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
...
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
Thanks
Lee

report viewer is blank

work with visual studio 2012. I need to load my report viewer inside a div in my web page. But it would be blank. It works fine a separate web page alone, but when I want to load it inside a section inside my content page, it is blank. The part of my code which works with report viewer:
// add a div dynamically
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes.Add("id", "chart05");
div.Attributes.Add("runat", "server");
div.Attributes["class"] = "chartItem";
sanaChartsContainer.Controls.Add(div);
Microsoft.Reporting.WebForms.ReportViewer viewer = new Microsoft.Reporting.WebForms.ReportViewer();
viewer.Attributes.Add("id", "ReportViewer");
viewer.Attributes.Add("runat", "server");
viewer.Attributes.Add("Font-Names", "Verdana");
viewer.Attributes.Add("Font-Size", "8pt");
viewer.Attributes.Add("Height", "50px");
viewer.Attributes.Add("ProcessingMode", "Remote");
viewer.Attributes.Add("WaitMessageFont-Name", "Verdana");
viewer.Attributes.Add("WaitMessageFont-Size", "14pt");
viewer.Attributes.Add("Width", "50px");
viewer.Attributes.Add("AsyncRendering", "false");
viewer.ServerReport.Refresh();
viewer.ShowParameterPrompts = false;
Uri baseUri = new Uri("http://mdb165.cbi.net/reportserver");
viewer.ServerReport.ReportServerUrl = baseUri;
viewer.ServerReport.ReportPath = "/SanaII/report005";
System.Web.UI.ScriptManager scriptManager = new ScriptManager();
Page page = new Page();
System.Web.UI.HtmlControls.HtmlForm form = new HtmlForm();
//div.Controls.Add(scriptManager);
div.Controls.Add(viewer);
My web config is:
<configuration>
<system.web>
<compilation debug="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</buildProviders>
</compilation>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</handlers>
</system.webServer>
</configuration>
I also added script manager to my page,
but report viewer is blank.
I also tried to load it directly in my content page as below shows:
but this is also doesn't work and is blank.
Please give me help.
Have you tried adding if(!IsPostBack) in your Page_Load?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SetDate();
BindCustomerCategory();
BindUtility();
}
}
OR if this will not work. Double check the aspx of your report page you might forgot something there..

URL Routing not working on server in Asp.Net

Here DataList.aspx & Details.aspx is inside directory v1, so i tried routing in two ways but nothing is working on server.
Global.asax
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("Route1",
"Category/{Brand}.html","~/DataList.aspx");
RouteTable.Routes.MapPageRoute("Route2",
"Category/{Brand}/{Title}.html","~/v1/Details.aspx");
}
I am using this routing in hyperlink inside listview. Url is generated correctly, but when i click on link it shows
"404 - File or directory not found."
I have also added this in web.config
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e42" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e42" />
</handlers>
</system.webServer>

WSFederationAuthenticationModule.RedirectingToIdentityProvider event is not called

I have 2 events in my Global.asax.cs file
WSFederationAuthenticationModule_SecurityTokenValidated and WSFederationAuthenticationModule_RedirectingToIdentityProvider
WSFederationAuthenticationModule_RedirectingToIdentityProvider is not called by wif engine. Why?
public class MvcApplication : System.Web.HttpApplication
{
void WSFederationAuthenticationModule_SecurityTokenValidated(object sender, SecurityTokenValidatedEventArgs e)
{
FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true;
}
void WSFederationAuthenticationModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
{
//some code
}
}
This is microsoft.identityModel section in web.config
<microsoft.identityModel>
<service saveBootstrapTokens="true">
<audienceUris mode="Never">
</audienceUris>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="http://localhost/dss.web.sts.tokenbaker/" realm="http://localhost/dss.web.frontend" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="308efdee6453fff68c402e5eceee5b8bb9eaa619" name="servcert" />
</trustedIssuers>
</issuerNameRegistry>
</service>
</microsoft.identityModel>
You are missing following lines in your web.config:
In configSections element:
<section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
In system.webServer element
<modules>
<remove name="FormsAuthentication" />
<add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
<add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
</modules>
Your audience Uris is empty. You have to specify your web application, so it can consume this functionality. So, add this line :
<audienceUris>
<add value="http://localhost/dss.web.frontend"/>
</audienceUris>
If your problems reamined after this changes, you can implement your custom authentication module derived from WSFederationAuthenticationModule. Something like this :
public class CustomAuthenticationModule : WSFederationAuthenticationModule
{
public CustomAuthenticationModule()
{
base.SecurityTokenReceived += CustomAuthenticationModule_SecurityTokenReceived;
}
public void CustomAuthenticationModule_SecurityTokenReceived(object sender, SecurityTokenReceivedEventArgs e)
{
}
protected override void OnAuthenticateRequest(object sender, EventArgs args)
{
base.OnAuthenticateRequest(sender, args);
}
}
and then just in config change instead of WSFederationAuthenticationModule put CustomAuthenticationModule with appropriate namespace and assembly signature. So you can intercept calls in your delegate.
Hope this is helpful for you.
Rastko
Add the following to your Global.asax.cs:
void Application_Start()
{
FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated;
}
void OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
{
FederatedAuthentication.WSFederationAuthenticationModule.RedirectingToIdentityProvider += WSFederationAuthenticationModule_RedirectingToIdentityProvider;
}
Credit to https://stackoverflow.com/a/9207505/13932
Make sure you're referencing WSFederationAuthenticationModule from the new namespaceSystem.IdentityModel.Services.
In my case I was still referencing it from the old Microsoft.IdentityModel.Web namespace after migrating the solution to .NET 4.5.
Found my answer here.
It sounds like you may be missing the WSFederationAuthenticationModule in your configuration. Make sure you have this in system.webServer\modules:
<add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
And this in system.web\httpModules:
<add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Read here for more information.
One thing to check is that you are referencing a consistent assembly between your web.config module and your Global.asax.cs using statement. Since the type RedirectingToIdentityProviderEventArgs exists in both System.IdentityModel.Services and Microsoft.IdentityModel.Web (as of .NET 4.5) you might be adding the module from one assembly in web.config but referencing the event arg from the other assembly in Global.asax.cs. I think that would fail.
My problem was that I had the following modules added to both the system.web/httpModules and system.webServer/modules sections.
<add name="WsFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
<add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
Removing the elements from the system.web/httpModules section solved the issue and all events attached to the WSFederationAuthenticationModule instance were being fired.
For the people who are sub-classing WSFederationAuthenticationModule and therefor changing the module registration name in the web.config and are using the auto wiring approach (inside the global.asax.cs) you will also have need to change the beginning of the method name.
For example if you have the following in system.webServer\modules
<add name="CustomWsFedModule" type="SomeLib.CustomWSFederationAuthenticationModule" preCondition="managedHandler" />
You will need the following inside your global.asax.cs
public class MvcApplication : System.Web.HttpApplication
{
void CustomWsFedModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
{
//some code
}
}

Url Routing for the page inside a folder in asp.net 4.0?

I am trying to implement Url routing in asp.net 4.0. I just a created a small test application. I am trying to browse the pages kept inside the folder. It works fine when i am running in Visual studio..but when i hosted the application in IIS7 then it showed an error.
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
The code i used is. (i am using master page too.)
protected void Application_Start(object sender, EventArgs e)
{
CustomRouteTable(RouteTable.Routes);
}
void CustomRouteTable(RouteCollection routes)
{
routes.MapPageRoute("Telugu", "Movie/Telugu", "~/Telugu/Telugu.aspx");
}
in my default.aspx page i kept a button and on click of the button i wrote.
protected void btnTelugu_Click(object sender, ImageClickEventArgs e)
{
Response.RedirectToRoute("Telugu");
}
where am i going wrong???
Thanks.
protected void btnTelugu_Click(object sender, ImageClickEventArgs e)
{
Response.RedirectToRoute("Movie/Telugu");
}
Have you updated your web.config to support URL Routing on IIS7.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=3.5.0.0,
Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
<!-- ... -->
</modules>
<handlers>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
<!-- ... -->
</handlers>
</system.webServer>
Here is the artice where I c/p the example from, that will give you more details.
http://msdn.microsoft.com/en-us/magazine/dd347546.aspx

Resources