Receive POST Data in a web app

Hello,

we need to have a browser launch our web app with a form post and start a new session in our web app using the data from the form.

We had two ideas on how to do this:

  1. get the post data in the session.open event, but I don’t see a property for this. Someone has an idea?
  2. use HandleSpecialURL, get post data there, store data, send out a redirect to browser, so it comes back with get event. Pick data later.

Comments? Ideas?
Or maybe we need some feature requests?

Use the HandleSpecialURL method for now. Changing our framework to allow the first one will be a monumental task and we have other things we need to do first.

but where is the post data for HandleSpecialURL?

Try this:

WebRequest.Entity

(although I think it may be broken in r3)

In my tests this was always empty. :frowning:

Feedback case 30811.

the problem for me is that we may get some bigger xml here, and if you parse that into Querystring, we have trouble. So please do not clear Entity in that case.
And not sure why you put form data into query string at all. If the form has a JPEG inside this may be a big string operation you do there.

Try it in r4 when it comes out. Entity will include only data that is included in the body of a request. QueryString is for the parameters that were actually in the URL.

Thank you very much.

I noticed that this got fixed several releases ago, as I was testing on my OS X 10.8.5 machine, however when I upload to a CentOS 6.5 machine, the Entity is again empty. Has anyone else noticed this too?

Yes I have also noticed the POST is empty. What’s interesting is when using a HTTP tool the POST data was processed but when doing it from a browser it was not.

Ugh. Sounds like we fixed the standalone code and not cgi. Please file a bug report and reference the old one #30811, so we can get it fixed quickly.

I’ve posted it as issue 31588 . This is a show-stopper for me. I can continue to develop my project, but I can’t test or deploy on the server until this is resolved. I’m not sure of a workaround for this one. If anyone else has crossed this and found one, it would be great to hear.

Has there been any progress on fixing this or is there a workaround for it? I’ve developed an app to verify PayPal payments and generate a registration key for selling my software but WebRequest.QueryString always returns an empty string. I’m dead in the water on this until I can find a way to read in the query string from PayPal.

I found a workaround for the problem. I created a Session property for the query string and in the Session.Open event get it from the environment variables:

  QString = System.EnvironmentVariable("QUERY_STRING")

Problems with POST data in HandleSpecialURL are corrected?

Yup :slight_smile:

As of 2014r2, HandleSpecialUrl should be working, and working consistently between standalone and cgi.

The bug (which was fixed) was that whenever you had POST variables being sent (like from an HTML form), the framework was parsing them into the dictionary which was accessed through the GetParameter method of the WebRequest. This had some unintended side effects, including the fact that if you also had parameters in the querystring, the POST variables would overwrite them. the change we made was to make it always the responsibility of the developer to parse the POST content. That way there’s no magic behind he scenes, potentially corrupting the incoming data. If you are getting form data, it will most likely be in the format:

var1=value1&var2=value2&var3=value3

It’ll be relatively easy to parse, just keep in mind that you may need to run DecodeURLComponent on the values because things like spaces and non ascii characters will probably be encoded.

I’ve been reading several posts about POST variables and I understand that you need to get at the data in the HandleSpecialURL via the Request.Entity property. But why can’t I get access to this data from the Session e.g. in the Open event. I have to capture the data in the HandleSpecialURL, and then redirect using a query string to the same application to start a session.

How do I pass content such as PNG data that is POSTed? Why is the POST data not available in to the Session?

I’m clearly missing something.

Thanks in advance.

[quote=189418:@Jim Brock]I’ve been reading several posts about POST variables and I understand that you need to get at the data in the HandleSpecialURL via the Request.Entity property. But why can’t I get access to this data from the Session e.g. in the Open event. I have to capture the data in the HandleSpecialURL, and then redirect using a query string to the same application to start a session.

How do I pass content such as PNG data that is POSTed? Why is the POST data not available in to the Session?

I’m clearly missing something.

Thanks in advance.[/quote]

In HandleURL/HandleSpecialURL the session is not there. You must look into WebRequest. Then to redirect to the same app, you cannot use ShowURL. The best way I found was to use HTML Refresh in Request.Print

[code]

[/code]

[quote=189418:@Jim Brock]I’ve been reading several posts about POST variables and I understand that you need to get at the data in the HandleSpecialURL via the Request.Entity property. But why can’t I get access to this data from the Session e.g. in the Open event. I have to capture the data in the HandleSpecialURL, and then redirect using a query string to the same application to start a session.

How do I pass content such as PNG data that is POSTed? Why is the POST data not available in to the Session?

I’m clearly missing something.

Thanks in advance.[/quote]
Where is the posted data coming from?

Sessions require A browser capable of running JavaScript and are made up of a series of back and forth connections. An HTTP POST by itself is typically not this. FWIW even a Session starts out as just a plain request (and to some extent you can capture that initial request in App.HandleUrl), but once a session starts, we actually code all calls from then on so that the back end can figure out which session it belongs to.