Advertisement
Guest User

Untitled

a guest
Mar 29th, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. [WebMethod]
  2. [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  3. public void Auth(string username)
  4. {
  5. string password = "";
  6. using (SqlConnection con = new SqlConnection(GetConnectionString()))
  7. {
  8. SqlCommand cmd = new SqlCommand("Select PASSWORD from users where USERNAME = '" + username + "'", con);
  9.  
  10. //Open Connection
  11. con.Open();
  12.  
  13. //To Read From SQL Server
  14. SqlDataReader dr = cmd.ExecuteReader();
  15.  
  16. while (dr.Read())
  17. {
  18. password = dr["PASSWORD"].ToString();
  19. }
  20.  
  21. //Close Connection
  22. dr.Close();
  23. con.Close();
  24. this.Context.Response.ContentType = "application/json; charset=utf-8";
  25. this.Context.Response.Write(password);
  26.  
  27. }
  28. }
  29.  
  30. service.Login = function (username, password, callback) {
  31. var q = $q.defer;
  32. $http({
  33. url: 'services/ShiftLogService.asmx/Auth',
  34. dataType: "json",
  35. method: "POST",
  36. data: { username: username }
  37. }).success(function (data) {
  38. console.log(data);
  39. }).error(function (data) {
  40. // q.reject();
  41. });
  42. return q.promise;
  43.  
  44. };
  45.  
  46. SyntaxError: Unexpected token l
  47. at Object.parse (native)
  48. at uc (http://localhost:15380/bower_components/angular/angular.min.js:17:6)
  49. at ac (http://localhost:15380/bower_components/angular/angular.min.js:90:253)
  50. at http://localhost:15380/bower_components/angular/angular.min.js:91:164
  51. at q (http://localhost:15380/bower_components/angular/angular.min.js:7:355)
  52. at ed (http://localhost:15380/bower_components/angular/angular.min.js:91:146)
  53. at c (http://localhost:15380/bower_components/angular/angular.min.js:92:403)
  54. at http://localhost:15380/bower_components/angular/angular.min.js:128:305
  55. at m.$eval (http://localhost:15380/bower_components/angular/angular.min.js:142:467)
  56. at m.$digest (http://localhost:15380/bower_components/angular/angular.min.js:140:47)(anonymous function) @ angular.js:13363(anonymous function) @ angular.js:10162(anonymous function) @ angular.js:15621m.$eval @ angular.js:17059m.$digest @ angular.js:16771m.$apply @ angular.js:17121g @ angular.js:11298x @ angular.js:11561v.onload @ angular.js:11624
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement