0
votes

I am getting this error (at the bottom) when I try to run this code using a generic handler

Jquery Code

 $.post("CheckUserName.ashx?username=Aaron902", 
                    function (result) { 
                        $('#username_availability_result').html('Name already exist!'); 

                        if (result == "exists") { 
                            $('#username_availability_result').html('Name already exist!'); 
                        } 
                        else { 
                            $('#username_availability_result').html('Still available'); 
                        } 

                    }); 

Handler Code

 public void ProcessRequest(HttpContext context) 
        { 
            string user_name = context.Request.QueryString["username"]; 
            string output = "here"; 
            output = CheckUserNameAvailability(user_name); 
            context.Response.Write(output); 
            context.Response.End(); 

        } 

Server Error in '/' Application.

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'Dating.CheckUserName'.

Source Error: Line 1: <%@ WebHandler Language="C#" CodeBehind="CheckUserName.ashx.cs" class="Dating.CheckUserName" %>

Source File: /CheckUserName.ashx Line: 1


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237

1
Seems to be an error in the CheckUserName.ashx.cs, can you post the whole .cs file? Did the project compile successfully?Akos Lukacs
The parser error says that the loaded assemblies do not have a class called Dating.CheckUserName in them. Is the CheckUserName class you specified in CheckUserName.ashx.cs contained in the Dating namespace? If this error is occurring on the production site, have you uploaded your newly built DLLs?lsuarez
I'll post the full code when I get home.scripter78
It does compile fine and its not productionscripter78
kinda stinks to have to do it this way but this comment box wont allow me to put the full code so you can view it here jsfiddle.net/8Fv98 i know the code is not javascript but hey it works for what i am needing it for and that is just to show what my code isscripter78

1 Answers

1
votes

I found a fix to my issue although I am not sure why it works this way and not the original way. All I did was remove the code behind file and put all the code that was there into the ashx file instead of having it in the ashx.cs file.

Of course I removed the directive CodeBehind="CheckUserName.ashx.cs"