{ SqlConnection con = null; SqlCommand cmd = null; con = new SqlConnection(); cmd = new SqlCommand(); con.ConnectionString = ConfigurationManager.ConnectionStrings["PostA ngularJS"].ConnectionString; try { con.Open(); cmd = new SqlCommand("spSavetblUser", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserName", HttpContext.Current.Req uest.Form["UserName"].ToString()); cmd.Parameters.AddWithValue("@Password", HttpContext.Current.Req uest.Form["Password"].ToString()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); DatatableToJson(ds.Tables[0]);
JavaScriptSerializer js = new JavaScriptSerializer();
string json = js.Serialize(DatatableToJson(ds.Tables[0])); this.Context.Response.ContentType = "application/json; charset=u tf-8"; // Changing the type of XML format to charset=utf-8 this.Context.Response.Write(json); }