ASIHTTPRequest Disabling Cache - objective-c

I have an application which logs into an online site using POST form being sent from ASIHTTPRequest & ASIFormDataRequest.
I have a log in box, a .xib where user enters their details. Then as they click OK, it connects to the site with the details user has entered. It sends the form OK etc.
But there is a problem. I enter the incorrect details first, it connects and tells me the html of response. I can tell from the html that the details are incorrect. Now i enter the correct details, and ASI* does not even bother connecting.
When I enter the correct details first, it tells me a different html which is supposed to show whenever I enter the right log in details.
So the problem is in cache, because it doesn't bother connecting again on second request, right?
I am using Little Snitch.app, so i know when it connects, and when it does not.
Now, the question sounds: "How do I disable Cache in ASIRequests?"
Thanks a lot.
Snippet of class: http://pastebin.com/a83YCpnm

ASIHTTPRequest doesn't cache POST responses by default - see the following code in ASIHTTPRequest.m
if (![[self requestMethod] isEqualToString:#"GET"]) {
[self setDownloadCache:nil];
}
There's clearly something else going on - are you sure it's a POST request you're making? How are you enabling caching / creating the request, can you post some code please?

Alright I found out what the trouble was. I did not reallocate the ASIFormDataRequest & ASIHTTPRequest on each request, which was causing the trouble on other requests because it was being reused.
Therefore the request has been marked as complete and so it did not even bother making another request if that makes sense.
Thanks

Related

Redis-backed session state not saving everything

We are trying to move from server session (IIS) to Redis-backed session. I updated my web.config with the custom sessionState configuration. I'm finding that only SOME of my key/value pairs are being saved. Of the 5 I expect to be in there, there are only 2. I verified all my code is ultimately hitting HttpContext.Current.Session.Add. I verified that my POCOs are marked as serializable. Looking at monitoring, I see that it adds the first two pairs, then everything after that just doesn't make it. No hit, no rejection, no exceptions. Nothing.
Anyone ever see this? Know where I could start to look to resolve?
TIA,
Matt
Update 1: I've switched to using a JSON serializer to store my data. Same thing. Doesn't seem to be a serialization issue.
Update 2: I've now downloaded the source code, compiled and am debugging it. The method SetAndReleaseItemExclusive, which seems to send the session items to Redis, is only hit once, though it should be hit more than once as my web site handle SSO and bounces from page to page to load the user and such. Have to investigate why it's only firing once...
Figured it out. Turns out that my AJAX request to an "API" endpoint without my MVC app did not have the appropriate session state attached. Therefore, the SetAndReleaseItemExclusive was never called. Adding this fixed it:
protected void Application_PostAuthorizeRequest()
{
if (HttpContext.Current.Request.Url.LocalPath == "/api/user/load")
HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
else
HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.ReadOnly);
}

Need Http Request not to respond until it finds a specific text in Jmeter

I have searched for the solution to my problem throughout the web, but couldn't find any.
I need jmeter not to throw a response of an HTTP Request until it founds an specific text in response, because I have this request which takes so much time to respond and generate an specific text, but http request responds back immediately hence not find that specific text.
How to do it? should I use some kind of logic controller, which one and how?
As I am new to Jmeter so I need a proper guidance and solution to this problem.
If what you want is wait for a page change that will display the expected text, then this might be the answer otherwise try to clarify:
http://www.sourcepole.ch/2011/1/4/waiting-for-a-page-change-in-jmeter

server problem in objective-c

I am hitting an url when the server shutdown.Then the program hang up.May i know how to handle the error when the server shutdown.I mean at that situation I want to give an alert.
Thanks in advance
this is in objective-c
Check reachability api code example in cocoa documentation.
The delegate you supply to an NSURLConnection should handle the error. It will receive the -connection:didFailWithError: message in the event that anything goes wrong. Listing 4 here gives a simple example of just logging the error. If you want an alert dialog to appear you can just sent -presentError: with the NSError as a parameter to a view or a NSDocumentController.

Retrieving HTTP status code from a loaded xul:browser tag

Thanks to everyone in advance -
I took a look at this -
An observer for page loads in a custom xul:browser
I am guessing that might be a path for determining the HTTP status code, but does anyone know of an easier way? I have flipped through the contentDocument as well...no dice.
Any ideas?
Thanks,
Sam
I looked for a bit and I don't think there is an easier way. The HTTP status code is an attribute of a request (and only of an HTTP request), so it appears to die with the request object (nsIHttpChannel), since nothing cares to save it.
You might be interested in this Firefox project, by the way: https://wiki.mozilla.org/Firefox/Projects/Network_Error_Pages

SimpleModal 1.3.2 Contact Form Not Sending

I just downloaded the SimpleModal 1.3.2 Contact Form to my localhost to try it out; the only change I've made is to the user settings in data/contact.php. I get the thankyou message and SimpleModal closes after I hit "send". However, something prevents the email from being sent; I never receive it in my inbox. Any comments would be welcome; it's a slick system and I'd like to use it.
Typically, that means that the problem is on the server end. You can uncomment the # in front of #mail (data/contact.php) to see if you get a server error back. If not, it means there is a problem on the system with mail delivery.
Let me know what you find out.
The fix was very simple, I just had to modify the post url path in contact.js, line 117.
Thank you very much for such a beautiful and functional contact form,
Best