Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. //the jsonDataObj looks like: 1,t
  2. function sendData(jsonDataObj) {
  3. var status = "";
  4.  
  5. jQuery.ajax({
  6. type: "POST",
  7. url: '/a/handlers/dowork.ashx/doit',
  8. data: jsonDataObj,
  9. contentType: "application/json; charset=utf-8",
  10. dataType: "json",
  11. success: function (output, status, xhr) {
  12. status = xhr.responseText;
  13. statusCode = xhr.status;
  14. console.log(status + " " + statusCode);
  15. },
  16. error: function (xhr, textStatus, errorThrown) {
  17. status = "{'d':'0," + errorThrown + "'}";
  18. status = status.replace(/'/g, '"');
  19. statusCode = xhr.status;
  20. console.log(status + " " + statusCode);
  21. }
  22. });
  23. }
  24.  
  25. using System;
  26. using System.Collections;
  27. using System.Collections.Generic;
  28. using System.Data;
  29. using System.Diagnostics;
  30. using System.Linq;
  31. using System.Web;
  32. using System.Web.Services;
  33. using System.Web.Script.Serialization;
  34. using System.Text;
  35. using System.Configuration;
  36. using System.Web.UI;
  37. using System.Web.UI.WebControls;
  38. using System.Xml;
  39. using Elmah;
  40.  
  41. namespace myapp
  42. {
  43. public class dowork : System.Web.UI.Page, IHttpHandler
  44. {
  45.  
  46. public void ProcessRequest(HttpContext context)
  47. {
  48. }
  49. public bool IsReusable
  50. {
  51. get { return false; }
  52. }
  53.  
  54. [System.Web.Services.WebMethod()]
  55. public static string doit(object data)
  56. {
  57. string status = string.Empty;
  58. string number = string.Empty;
  59. string letter = string.Empty;
  60. dynamic strings = ((IEnumerable)data).Cast<object>().Select(x => x == null ? x : x.ToString()).ToArray();
  61.  
  62. number = strings(0).ToString();
  63. letter = strings(1).ToString();
  64.  
  65. status = number + letter;
  66. return status;
  67. }
  68. }
  69. }
  70.  
  71. Server Error in '/' Application.
  72. Parser Error
  73. 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.
  74. Parser Error Message: Could not create type 'myapp.a.handlers.dowork'.
  75. Source Error:
  76. Line 1: <%@ WebHandler Language="C#" CodeBehind="dowork.ashx.cs" Class="myapp.a.handlers.dowork" %>
  77. Source File: /a/handlers/dowork.ashx Line: 1
  78. Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1038.0
  79.  
  80. Line 1: <%@ WebHandler Language="C#" CodeBehind="dowork.ashx.cs" Class="myapp.a.handlers.dowork" %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement