0

My ActionHandler.ashx file should be POSTed yet upon entry to ProcessRequest the context.Request.RequestType is always "GET".

Background: This HttpHandler currently works OK (i.e. clicking a link in an email causes my ActionHandler.ashx to be entered and the querystring is processed correctly). For example:

https://mdwdata/CorporateBrain/ActionHandler.ashx?Action=MarkComplete&ID=1024~nzmewoojgnn&CUID=13

is the URL for the link shown as Mark-Complete in the image just below:

But now I am trying to improve it by following this advice in a previous SO thread :

"In the body of the email, instead of sending a link, include an HTML form that contains a button which performs a postback to your server."

Problem Summary: When I click the Submit button, my handler is entered with verb GET not POST (hence, I have no access to the hidden form data in the Request.Form collection.

Here is a snippet (image) of the email bodyHere is a snippet of the email body:

If I can get the Submit to post the hidden form variables to my handler, then of course I would remove the links. In the debugger, I verified the form data and it looks good me: enter image description here

I added this line to my web.config file:

<add path="ActionHandler.ashx" verb="GET,POST" type="System.Web.UI.SimpleHandlerFactory" validate="true" />

Also, my email client is Thunderbird.

What would cause the request to be GET instead of POST?

Community
  • 1
  • 1
John Adams
  • 4,773
  • 25
  • 91
  • 131
  • [Forms in HTML email](https://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/)? Unsure about Thunderbird specifically, but the caveat from way back (circa 2007) applies. Can you view the source in the client? – EdSF Oct 17 '14 at 01:43
  • @EdSF - yeah, I am a bit unsure about this too. Just following advice in the previous SO thread referenced above in the original post. This approach needs to work with all email clients. I do not see a way to "view source" within the Thunderbird client. I will carefully study the link you provide (seems to contradict advice I mentioned above). I was thinking that the "concept" was OK and perhaps I'm just missing something like a special web.config entry, etc. – John Adams Oct 17 '14 at 14:50

1 Answers1

0

The short answer to this problem is that Thunderbird does not POST to the URL in the Action attribute of the HTML form tag. Even the newest version of Thunderbird (version 31.2.0) "ignores" the POST and requests the URL via GET.

The construction of the HTML form is properly done and other email clients I have tested work fine:

  • Microsoft Office 365 Outlook Web App
  • Google GMail

So, I guess I am doing it "right" but some email clients apparently don't support this (even my favorite which is Thunderbird).

John Adams
  • 4,773
  • 25
  • 91
  • 131
  • Interesting. Faced with this situation I'd likely include some text in the email about "If your email client does not support forms, click here to go to the site." or something like that. – NotMe Oct 17 '14 at 20:10