Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //the jsonDataObj looks like: 1,t
- function sendData(jsonDataObj) {
- var status = "";
- jQuery.ajax({
- type: "POST",
- url: '/a/handlers/dowork.ashx/doit',
- data: jsonDataObj,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (output, status, xhr) {
- status = xhr.responseText;
- statusCode = xhr.status;
- console.log(status + " " + statusCode);
- },
- error: function (xhr, textStatus, errorThrown) {
- status = "{'d':'0," + errorThrown + "'}";
- status = status.replace(/'/g, '"');
- statusCode = xhr.status;
- console.log(status + " " + statusCode);
- }
- });
- }
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics;
- using System.Linq;
- using System.Web;
- using System.Web.Services;
- using System.Web.Script.Serialization;
- using System.Text;
- using System.Configuration;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Xml;
- using Elmah;
- namespace myapp
- {
- public class dowork : System.Web.UI.Page, IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- }
- public bool IsReusable
- {
- get { return false; }
- }
- [System.Web.Services.WebMethod()]
- public static string doit(object data)
- {
- string status = string.Empty;
- string number = string.Empty;
- string letter = string.Empty;
- dynamic strings = ((IEnumerable)data).Cast<object>().Select(x => x == null ? x : x.ToString()).ToArray();
- number = strings(0).ToString();
- letter = strings(1).ToString();
- status = number + letter;
- return status;
- }
- }
- }
- 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 'myapp.a.handlers.dowork'.
- Source Error:
- Line 1: <%@ WebHandler Language="C#" CodeBehind="dowork.ashx.cs" Class="myapp.a.handlers.dowork" %>
- Source File: /a/handlers/dowork.ashx Line: 1
- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1038.0
- Line 1: <%@ WebHandler Language="C#" CodeBehind="dowork.ashx.cs" Class="myapp.a.handlers.dowork" %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement