TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sadifasiodfuhsa sadfsadfsfd
NA
30
0
Authentication failed in call webmethod from jquery AJAX
Apr 11 2014 10:49 AM
In here i call webmethod from Jquery Ajax.In the success function i saw there's a error called "Authentication Failed"
My WebMethod
[WebMethod,ScriptMethod] public static List<UploadedFiles> GetAllUploadedFiles() { List<UploadedFiles> UploadedFilesDetails = new List<UploadedFiles>(); try { SqlCommand comGetAllFiles = new SqlCommand("SP_GetAllUploadedFiles", conDB); comGetAllFiles.CommandType = CommandType.StoredProcedure; if (conDB.State == ConnectionState.Closed) conDB.Open(); SqlDataReader rdr = comGetAllFiles.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rdr); foreach (DataRow r in dt.Rows) { UploadedFilesDetails.Add(new UploadedFiles { Id = (int)r["Id"], UserId =(Guid)r["UserId"], FilePath = r["FilePath"].ToString(), Date =(DateTime) r["Date"] }); } } catch(Exception ee) { } finally { conDB.Close(); } return UploadedFilesDetails; }
My Ajax Function
<script> $(function () { LoadUploadFiles(); }); function LoadUploadFiles() { var url = '<%=ResolveUrl("WebMethods.aspx/GetAllUploadedFiles") %>'; $.ajax({ url: url, type: "post", dataType: "json", contentType: "application/json; charset=utf-8", success: function (Result) { debugger; $.each(Result.d, function (key, value) { alert("y"); $("#uploaddata").append($("<table><tr></tr></table>").val (value.Id).html(value.FilePath)); }); }, error: function (e, x) { alert(x.ResponseText); } }); } </script>
In my Web.Config file
<location path="WebMethods.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web>
Reply
Answers (
2
)
How to Write Regular Expression
C# File Properties