Solved

Security token service isn't passed to server when i have ajax request.

Posted on 2011-09-07
7
406 Views
Last Modified: 2013-01-21
I have a strange issue that I cannot figure out.
I am doing an AJAX request as follows:

    $.ajax({
        type: "POST",
        url: "ajax/getCities.htm",
        dataType: "html",
               success: populateCityCountyFromSession
    });

For some reason, the firebug show a 302 error code for POST request and a failed GET request (because the parameters are not being sent). If I put a breakpoint in the javascript and iterate through then the GET request doesn't happen, so I've been unable to determine whether or not the issue has to do with jQuery.

Finally i found one thing, for ajax or jquery request the authenticated cookie(Wif ) isn't passed,

How to i pass the wif authenticated cookie to server for asynchronous request.

For GET and POST also same occuring...
0
Comment
Question by:Praveen_Bobbili
  • 5
  • 2
7 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36494443
You can't post to the html file, since HTML will not be executed on the server. You need to use GET. If you want the cookie values to be processed on server, then you need to post it to server side script and also append the cookies name/value to the URL
0
 
LVL 1

Author Comment

by:Praveen_Bobbili
ID: 36501451
Even Ajax get request also failed to pass the authenticated WIF cookie
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36501556
Pass to whom? HTML page? html page gets executed on client and client already have the cookies.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:Praveen_Bobbili
ID: 36709561
No luck.....................
0
 
LVL 1

Author Comment

by:Praveen_Bobbili
ID: 38781668
No luck.....................
0
 
LVL 1

Accepted Solution

by:
Praveen_Bobbili earned 0 total points
ID: 38786227
$.ajax({
        type: "POST",
        url: "ajax/getCities.htm",
        dataType: "html",
               success: populateCityCountyFromSession
    });


Found the solution, by taking the url from the form tag issue solved. i found by goggling.
0
 
LVL 1

Author Closing Comment

by:Praveen_Bobbili
ID: 38800568
I hope this was the best solution i found
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XML & .net 5 40
Close word object 13 38
VB.net/WinForms: adjust Screen Resolution 6 41
jQuery AJAX Redirects Without Response/Error 10 45
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now