[Mono-bugs] [Bug 337997] New: web handler does not use codebehind class

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 30 18:08:44 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=337997

           Summary: web handler does not use codebehind class
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: i386
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: sloncho at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Hi,
I have filed a bug with monodevelop as this was my first impression. But more
and more I start to think that the problem actually is with ASP.Net runtime.

The original case is this:
https://bugzilla.novell.com/show_bug.cgi?id=337674

I'm pasting the whole case here as well (I'm adding one more finding at the
end):

Using:
monodevelop-0.16-2.2
mono-core-1.2.5.1-8.1
mono-web-1.2.5.1-8.1

OpenSuSE 10.3

When creating a new web handler with a codebehind class, the build works OK,
but when you hit the handler with a browser, it produces a runtime error, that
the class is not found. If I move the csharp code from the codebehind file in
the .ashx file, it works OK.

Steps to reproduce:
1. Create a new ASP.NET project
2. Set project's runtime to 1.1
3. Create GetPages.ashx (using template Web Handler - there are 2 of them,
doing one and the same in 0.16)
4. Create a GetPages.ashx.cs file.
5. Mark .cs file as "Include with Build", and .ashx as "Include with
Deployment" - see this is how it is done with web services with codebehind.
6. Move the csharp code from the .ashx to .cs file and implement the members:

file: GetPages.ashx:

<<%@ WebHandler Language="C#" Class="OfflinePages.GetPages" %>

file: GetPages.ashx.cs:

using System;
using System.Web;

namespace OfflinePages
{


        public class GetPages : System.Web.IHttpHandler
        {

                public virtual void ProcessRequest(HttpContext context)
                {
                        context.Response.Clear();
                        context.Response.Write("Test");
                        context.Response.End();
                }

                public bool IsReusable { get {return false;}}
        }
}


7. Build and start with xsp on port 8080
8. Hit with browser: http://localhost:8080/GetPages.ashx

Expected result: To display "Test" in the browser

Actual result: Runtime error:

Server Error in '/' Application
Could not load type 'OfflinePages.GetPages'.

Description: Error processing request.

Error Message: HTTP 500. System.TypeLoadException: Could not load type
'OfflinePages.GetPages'.

Stack Trace:

System.TypeLoadException: Could not load type 'OfflinePages.GetPages'.
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType
(System.Reflection.Module,string,bool,bool)
  at System.Reflection.Assembly.GetType (System.String name, Boolean
throwOnError, Boolean ignoreCase) [0x00000] 
  at System.Reflection.Assembly.GetType (System.String name, Boolean
throwOnError) [0x00000] 
  at System.Web.Compilation.WebServiceCompiler.GetCompiledType () [0x00000] 
  at System.Web.Compilation.WebServiceCompiler.CompileIntoType
(System.Web.UI.SimpleWebHandlerParser wService) [0x00000] 
  at System.Web.UI.WebHandlerParser.GetCompiledType (System.Web.HttpContext
context, System.String virtualPath, System.String physicalPath) [0x00000] 
  at System.Web.UI.SimpleHandlerFactory.GetHandler (System.Web.HttpContext
context, System.String requestType, System.String virtualPath, System.String
path) [0x00000] 
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context)
[0x00000] 
  at System.Web.HttpApplication+<>c__CompilerGenerated1.MoveNext () [0x00000] 

I have verified that:
1. using monodis, the class and the namespace are correct in
bin/OfflinePages.dll
2. If I copy the csharp code back in the .ashx file (even if I leave it in the
cs file), this example works.

3. This is a new one - if I reference another project/dll in the monodevelop
project, the file compiles ok (as code behind), but does not run, as before. If
I move the c# code back in the .ashx file, it fails to run with the exception
(received by intercepting the unhandled errors in Global.asax.cs:

Server error: System.Web.Compilation.CompilationException: Exception of type
System.Web.Compilation.CompilationException was thrown.
  at System.Web.Compilation.WebServiceCompiler.CheckCompilerErrors
(System.CodeDom.Compiler.CompilerResults results) [0x00000] 
  at System.Web.Compilation.WebServiceCompiler.GetCompiledType () [0x00000] 
  at System.Web.Compilation.WebServiceCompiler.CompileIntoType
(System.Web.UI.SimpleWebHandlerParser wService) [0x00000] 
  at System.Web.UI.WebHandlerParser.GetCompiledType (System.Web.HttpContext
context, System.String virtualPath, System.String physicalPath) [0x00000] 
  at System.Web.UI.SimpleHandlerFactory.GetHandler (System.Web.HttpContext
context, System.String requestType, System.String virtualPath, System.String
path) [0x00000] 
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context)
[0x00000] 
  at System.Web.HttpApplication+<>c__CompilerGenerated2.MoveNext () [0x00000]


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list