Question

We upgraded our web app from asp 3.5 to 4.0 framework with minor issues. Now a block of code that I used to be able to debug throws and error, but once I compile and publish it in release mode and deploy it to the server it works fine. The server is a 2008 enterprise iis 7. The block of code is below. The problem occurs. It is when page is changed to ihttphandler type so the page's request can be processed. When that line hits I get the IIS must be in Integrated mode. I checked the project. It is using the local ISS. The app pool is set to Integrated. What It is being attempted is to render the page in memory so that I can get at the controls contained on the page. What I don't understand is why it is working once published and deployed.

    Private Sub RetrieveControls(ByVal file As String)
        If Not String.IsNullOrEmpty(file) Then
            Dim s As New System.IO.MemoryStream()
            Dim w As New System.IO.StreamWriter(s)
            Dim path As String = Me.Request.Url.AbsolutePath
            path = path.Remove(path.LastIndexOf("/") + 1)
            Dim wr As New System.Web.Hosting.SimpleWorkerRequest(path & file, "security=true", w)

            Dim t As Type = System.Web.Compilation.BuildManager.GetCompiledType(path & file)
            Dim p As Page = Activator.CreateInstance(t)
            p = BuildManager.CreateInstanceFromVirtualPath("~/Screens/" & file, t)
            Dim con As New HttpContext(wr)


            CType(p, IHttpHandler).ProcessRequest(con)



            Dim containerPC As ContentPlaceHolder = p.Form.FindControl("PageContent")
            Dim containerBC As ContentPlaceHolder = p.Form.FindControl("ButtonContent")

            RecursiveControlDrill(containerPC)
            RecursiveControlDrill(containerBC)
            Master.sm.ModifyData(m_ci, "Controls", SessionManager.SessionDataType.Temporary)
        End If
    End Sub
Était-ce utile?

La solution

I Have found the answer. Through organization wide updates framework 4.5 was installed on the developer machines. Once that was removed and 4.0 was re-installed everything is now working fine again.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top