FDF Toolkit 6, SSL, ASP.NET 2.0 Handler, and Internet Explorer cannot display the webpage

We run into an interesting problem today while working with FDF Toolkit 6 inside ASP.NET 2.0 HttpHandler. Internet Explorer 7 refused to open a pre-populated PDF form produced by the handler when communicating with the server over SSL.

We could see data coming to the client and AcroRd32.exe starting... however the browser continued to display "Internet Explorer cannot display the webpage" message. The same code worked well in IE without SSL or in FireFox with or without SSL.

The problem was related to caching. For some reason, any of the lines below cause IE not to be able to open an FDF form:

context.Response.CacheControl = "no-cache";
context.Response.AddHeader("pragma", "no-cache");
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);

Removing these lines fixed the problem. Happy coding!

.NET 3.5, WCF, JSON, SSL, and HTTP Error Code 401

We run into an interesting problem today at work while working with JSON WCF Web Services built with Visual Studio 2008 and .NET 3.5.

The web application we are working on is to be released in a couple of weeks. It has been running fine on the test server for a number of iterations now, but today we installed an SSL certificate on this server and configured the application to require secure channel. Suddenly, the web application started to ask us for a username and password...

I looked closer into the logs and noticed the HTTP Error Code 401 (authorization error) coming back from web services when the web application requested our java script proxies. It turns out that in order to allow communication with the services via SSL, you need to configure additional binding configuration. See below our sample service model configuration. Hope it will save you a few hours of troubleshooting. 

<system.serviceModel>
    <behaviors
>
        <endpointBehaviors>
            <
behavior name="jsonBehavior">
                <enableWebScript />
            </
behavior>
        </endpointBehaviors>  

        <
serviceBehaviors>
            <behavior name="myServiceBehavior"
>
                <
serviceMetadata httpGetEnabled="true" httpGetUrl="" />  
                <serviceDebug includeExceptionDetailInFaults="true"
/>
                <serviceThrottling maxConcurrentCalls="100"
                                          maxConcurrentInstances="1000"
                                          maxConcurrentSessions="1000"/>
 
            </behavior
>
        </
serviceBehaviors> 
    </behaviors
>  

    <
bindings> 
        <webHttpBinding
>
            <
binding name="sslBinding"> 
                <security mode="Transport"
/>
            </
binding>
        </webHttpBinding> 
    </
bindings>  

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
/>
        <
services> 
            <service behaviorConfiguration="myServiceBehavior"
 
                        name="CourseCatalog"

            
<endpoint contract="CourseCatalog"
                               address=""
                               behaviorConfiguration="jsonBehavior"
                               binding="webHttpBinding"
                               bindingConfiguration="sslBinding"/>
 
                <endpoint contract="IMetadataExchange
                               address="mex
                               binding="mexHttpBinding" />
  
            </service>
 
    </services

</system.serviceModel>

Happy coding!

Welcome to ModelBlog

Thank you for visiting ModelBlog. We hope the time you spend with us will be both entertaining and worth your while. Have fun!

Authors

Search

Archive

Tags