This is a migrated thread and some comments may be shown as answers.

WebClient to Download Html Report

3 Answers 105 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Gilmar
Top achievements
Rank 1
Gilmar asked on 07 Nov 2013, 02:11 PM
I'm having trouble with the control HtmlPlaceHolder because he needs the Windowless parameter is set to 'True' and Browser Chrome accents the words do not work, and performance problems.
HtmlPlaceHolder I use in my reports. I then decided to switch to upload them in the form below so that my system could function with parameter Windowless = False

	    this._rtb = sender as RadRichTextBox;             
            Uri uri = new Uri("http://localhost:55555/Relatorio.aspx?idRelatorio=412b44b8-7d35-4ef6-96bd-c2011cea8b1c&nomeTabTemp=&gerarLog=1&idIdioma=00000000-0000-0000-0000-000000000000&ehRelSession=0&idUsuario=ab971b23-ffe3-4cee-add0-475c67da1a46&idAplicativo=3baae00e-66af-4f00-9f74-8829ff33392a&par=nmTabela$TB81F753A75F3B415CAB2037E094BA;idRegistro$b823b533-d2ca-4ec6-ac0d-455dc598eb8a;"); 
            WebClient wc = new WebClient();
            wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
            wc.DownloadStringAsync(uri);


        void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {                
                this._rtb.Document = new HtmlFormatProvider().Import(e.Result);
                this._rtb.Document.LayoutMode = Telerik.Windows.Documents.Model.DocumentLayoutMode.Flow;                
        }

I'm trying to use the control RadRichTextBox because I know he can import html. Then use WebClient to download the HTML content and display it in RadRichTextBox.
But every time I try to run the report it gives this error below. Report Viewer Configuration Error 
The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file, or add <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.webServer/handlers section for Internet Information Services 7 or later. But my Web.Config already have these two clauses requested. What might be happening?
Follow my Web.Config below

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>  
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      </assemblies>
    </compilation>
    <identity impersonate="false"/>
    <authentication mode="Forms"/>
    <!--<authentication mode="Windows"/>
    <authorization>
      <deny users="?"/>
      <allow users="*"/>
    </authorization>-->
    <httpRuntime maxRequestLength="102400" maxQueryStringLength="10000"/>
    <customErrors mode="Off"/>
    <httpHandlers>
          <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />                                                                           
    </httpHandlers>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBindingLongo" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="higherMessageSize" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Glaucus.Web.GlaucusPesquisaServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
        <behavior name="Glaucus.Web.GlaucusRelatorioServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
        <behavior name="Glaucus.Web.ControleAcessoServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
        <behavior name="Glaucus.Web.GlaucusUtilsServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
        <behavior name="ReportServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="Glaucus.Web.GlaucusPesquisaServiceBehavior" name="Glaucus.Web.GlaucusPesquisaService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingLongo" contract="Glaucus.Web.GlaucusPesquisaService"/>
      </service>
      <service behaviorConfiguration="Glaucus.Web.GlaucusRelatorioServiceBehavior" name="Glaucus.Web.GlaucusRelatorioService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingLongo" contract="Glaucus.Web.GlaucusRelatorioService"/>
      </service>
      <service behaviorConfiguration="Glaucus.Web.ControleAcessoServiceBehavior" name="Glaucus.Web.ControleAcessoService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingLongo" contract="Glaucus.Web.ControleAcessoService"/>
      </service>
      <service behaviorConfiguration="Glaucus.Web.GlaucusUtilsServiceBehavior" name="Glaucus.Web.GlaucusUtilsService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingLongo" contract="Glaucus.Web.GlaucusUtilsService"/>
      </service>
      <service name="Glaucus.Web.GlaucusDataService">
        <endpoint binding="webHttpBinding" bindingConfiguration="higherMessageSize" contract="System.Data.Services.IRequestHandler"/>
      </service>
      <service name="Telerik.Reporting.Service.ReportService" behaviorConfiguration="ReportServiceBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="Telerik.Reporting.Service.IReportService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="resources" binding="webHttpBinding" behaviorConfiguration="WebBehavior" contract="Telerik.Reporting.Service.IResourceService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <connectionStrings>
    <add name="GlaucusEntities" connectionString="metadata=~/GlaucusContext.csdl|~/GlaucusContext.ssdl|~/GlaucusContext.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=SDG;PASSWORD=SDG_DEMONSTRE_PRD;USER ID=SDG_DEMONSTRE_PRD&quot;" providerName="System.Data.EntityClient"/>
    <add name="connStrRelEspecificos" connectionString="DATA SOURCE=SDG;PASSWORD=SDG_DEMONSTRE_PRD;USER ID=SDG_DEMONSTRE_PRD" providerName="Oracle.DataAccess.Client"/>
  </connectionStrings>
  <appSettings>
    <add key="ID_IDIOMA_VERSAO" value="00000000-0000-0000-0000-000000000000"/>
    <add key="TIPO_BASE_DADOS" value="Oracle"/>
    <add key="TIPO_SERVIDOR_TEMPO" value="Web"/>
  </appSettings>
  <system.webServer>
    <defaultDocument>
      <files>
        <add value="Glaucus.Portal.aspx"/>
      </files>
    </defaultDocument>
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>    
    </handlers>
  </system.webServer>
</configuration>

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 12 Nov 2013, 09:22 AM
Hello,

Could you please share some additional details on when exactly you are observing this exception and your application logic? As far as I can tell from the code you pasted the only reason RadRichTextBox to not load the respective HTML is if the Uri is invalid. However, the observed by you error seems to be a server error and does not seem related to the control.

Let me know if I misunderstood you or you have additional feedback.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Gilmar
Top achievements
Rank 1
answered on 12 Nov 2013, 12:40 PM
Hello ,
I am trying to run a rdlc report with the Report Viewer . If I run only the address of the report in another browser tab the report runs . But when I try to download the report by the WebClient , the error related to Web.Config appears . The method DownloadStringAsync runs , but when it returns in the method wc_DownloadStringCompleted the final value of e.Result parameter is returned in bytes . When I import the stream with HtmlFormatProvider the result is this below.

Report Viewer Configuration Error
The Report Viewer Web Control HTTP Handler has not been registered in the application 's web.config file .
Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
to the system.web / httpHandlers section of the web.config file , or add < add name = " ReportViewerWebControlHandler " preCondition = " integratedMode " verb = " * " path = " Reserved.ReportViewerWebControl.axd " type = " Microsoft.Reporting . WebForms.HttpHandler , Microsoft.ReportViewer.WebForms , Version = 10.0.0.0 , Culture = neutral , PublicKeyToken = b03f5f7f11d50a3a " / >
to the system.webServer / handlers section for Internet Information Services 7 or later .

It seems that the WebClient does not recognize my Web.Config that is in my project. The two items needed for a rdlc report to work already in Web.Config as requested, but still does not recognize the WebClient.

I really appreciate the help. Here it is I'm going crazy with this error. Please


It seems that the WebClient does not recognize my Web.Config that is in my project . The two items needed for a rdlc report to work already in Web.Config as requested , but still does not recognize the WebClient .
0
Petya
Telerik team
answered on 13 Nov 2013, 04:24 PM
Hello,

I'm afraid I don't quite understand you. The result of the download should be a string as per the MSDN documentation. Furthermore, the logic in the wc_DownloadStringCompleted handler will work only if it the result is a valid HTML string. Could you verify that this is the case in your application?

The other thing that comes to mind is that the issue might be related to a cross-domain policy problem. You can check for example this stackoverflow thread with a similar issue.

I hope this helps! Let me know how it goes.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Gilmar
Top achievements
Rank 1
Answers by
Petya
Telerik team
Gilmar
Top achievements
Rank 1
Share this question
or