Classic ASP on Localhost, no form data? - forms

I have a really odd situation going on on my local PC that I can not seems to resolve.
Recently I have been contacted to extend a classic ASP website that I wrote a few years back. I unpacked the code into a sub folder of wwwroot on my current machine running XP pro. It has never had any classic ASP sites running on it. I set up IIS and create an application and run the website on my localhost. The site renders correctly and appears to run fine. Except one thing... The post data seems to get lost.
I have entered Response.Write("[" & Request.Form & "]") at the top of one of my pages and just renders "[]". Can any one advise as to why I may be losing the form data? The website used to work fine on my last machine running XP Pro, as that is the machine I developed it on. What have I forgotten to set up?
The html form code looks like
<form name="frmAdminLogin" actionAdminLogin.asp" method="post" >
<input type="hidden" name="hidFormAction" value="frmAdminLogin" >
<table width="80%" border="0" cellspacing="3" cellpadding="0" >
<tr>
<td width="40%" align="right" valign="top" >Username: </td>
<td width="60%" align="left" valign="top" >
<input type="text" name="txtUsername" value="" size="25" maxlength="25" tabindex="1" class="TextBox" >
</td>
</tr>
<tr>
<td width="40%" align="right" valign="top" >Password: </td>
<td width="60%" align="left" valign="top" >
<input type="password" name="txtPassword" value="" size="25" maxlength="25" tabindex="2" class="TextBox" >
</td>
</tr>
<tr>
<td width="100%" colspan="2" align="center" valign="top" >
<input type="submit" name="btnLogIn" value="Log In" tabindex="3" class="Button" >
<input type="reset" name="btnReset" value="Reset" tabindex="4" class="Button" >
</td>
</tr>
</table>
</form>

It appears that it is not an IIS issue after all but an Internet Explorer issue. The post data is present when I use Opera Browser.
I think this is correct - there is some bug (feature?) of Internet Explorer which prevents form data being submitted if there is only a single form element. If you add a extra element (hidden field, it really doesn't matter) it should work properly.
I'll try to expand this comment when I get a chance but my work firewall is preventing my finding the blog posts which originally pointed me in the right direction.

Related

HTML email displaying mangled in outlook.com

I'm sending a fairly simple multipart message containing both plain text and HTML versions. The HTML version is a table with some columns, all sized in percent. All styles are inline.
In outlook.com it renders terribly. Viewing source (in a browser - Firefox) I can see that it is mangling the HTML.
For instance the opening table tag is rendering like this:
(hmm - so mangled stackoverflow won't render it either).
Basically it is lopping off the first character of attributes, so width="100%" renders as width="00%", align="eft", links come up as "ttp://something.com", missing quotes, etc. Viewing source in outlook.com doesn't show the HTML at all - it must be rendered via javascript, as I can only see it using Firebug.
I've tried it both with and without the conditional comments (which are in place for Outlook the app), and with/without the doctype. Nothing makes it better. I don't have a clue what's going on, and not finding any other posts about attributes getting truncated.
Any thoughts?
Here's the HTML portion of the email:
<!DOCTYPE html>
<html>
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 14px;line-height: 1.4; color: #333;">
<!--[if (gte mso 9)|(IE)]>
<table width="600" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<![endif]-->
<table style="width: 100%; max-width: 600px;" align="left" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="3" width="100%" height="16"></td>
</tr>
<tr>
<td width="3%"></td>
<td><img src="https://www.domain.com/logo.png" width="203" height="38" alt="alt name" /></td>
<td width="3%"></td>
</tr>
<tr>
<td colspan="3" width="100%" height="30"></td>
</tr>
<tr>
<td width="3%"></td>
<td width="94%">
Hello,<br />
<br />
The Proof for Order Item #123 is ready for review. Please login to your account to review and approve the proof.<br />
<br />
Log in at https://www.domain.com/my-account/ and choose "Proofs Waiting Approval" on the "My Account" page.<br />
<br />
Click the "Review" link for ID 123 - you will see your proof and you will be able to approve it for delivery. You will also have the opportunity to request changes.<br />
<br />
Please contact our office if you have any questions.<br />
Thank you.<br />
<br />
Sincerely,<span style="font-size: 4px;"><br />
<br />
</span>
<span style="font-size:13px; font-weight: bold;">COMPANY TEAM</span><br />
<span style="font-size: 9px;"><span style="color: #2b9f4c;">COMPANY</span> | CUSTOMER SERVICE</span><span style="font-size: 11px;"><br />
<span style="font-weight: bold;color: #0c7ebd;">T:</span> 888.555.2122</span><span style="font-size: 4px;"><br />
<br />
</span>
<span style="font-size: 10px;">www.domain.com<span style="font-size: 3px;"><br />
<br />
</span>
<img src="https://www.domain.com/images/email/ConsiderEnvironment.png" width="37" height="42" alt="" /> <span style="color: #2b9f4c;">Please consider the environment before printing this email</span></span>
</td>
<td width="3%"></td>
</tr>
<tr>
<td colspan="3" width="100%" height="30"></td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</body>
</html>
your code looks pretty email friendly to me!
My only suggestion is check all your elements in accordance with Campaign Monitor's support guide (https://i3.campaignmonitor.com/assets/files/css/campaign-monitor-guide-to-css-in-email-may-2014.pdf?ver=5117&_ga=1.123317261.720201475.1441145331).
Another handy feature campaign monitor use is their testing system, this also gives a preview of what your email would look like in each browser/email client (outlook.com is supported). Unfortunately each test costs 5 Australian dollars but sometimes I find the fee is worth the headache as it's always accurate!
More info on this can be found here:
https://www.campaignmonitor.com/testing/
Ack - turns out I had the wrong Content-Transfer-Encoding. I had it set to quoted-printable but should have been 8bit or 7bit. quoted-printable assumes it's to be read as presented, and is not code to be interpreted. Or so I gather.
Oddly it worked just fine in every other client tested in. So - "thanks" outlook.com, for teaching me something...

ColdFusion submitting a form

I have a form where an user can add new people to the list. I need it to only allow the form to update if the required fields are filled out.
My current code works in Chrome or FireFox, but not with with Safari. In Chrome and FireFox, it will not submit the form unless the fields are filled out. However, Safari allows the user to submit the form even if it is left blank.
Is there any other way to write the code to make it work with all three browsers? Below is just a little of the code for some of the required fields.
<cfform method="post" action="##" name="aForm" id="addClientForm" class="">
<input type="hidden" name="method" value="clientAdd">
<input type="hidden" name="datasource" value="<cfoutput>#request.dsn#</cfoutput>">
<input type="hidden" name="Active" value="1">
<div style="float:left;" class="formContent470">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<th colspan="" style="text-align:left;">Add Client</th>
</tr>
<tr><cfoutput>
<td>
Contact
<span style="color:red">*</span>
<input type="Text" name="Contact" value="" required="Yes" message="Contact is required" maxLength="75" class="inputText430">
</td>
</tr>
<tr>
<td>
Client Name
<span style="color:red">*</span>
<input type="Text" name="ClientName" value="" required="Yes" message="Client Name is required" maxlength="75" class="inputText430">
</td>
</tr>
<tr>
<td>
Sounds to me like you're looking for server side validation. I would, of course, validate client side using Javascript and THEN back that up with server side.
Despite the well meaning advice avoid CFINPUT and CFFORM if you can (My opinion others may differ). You'll gain far greater flexibility/portability using a client side library like JQuery and sticking with plain Jane HTML form fields (steps off podium).
That being said, and assuming you'll stick with server side validation as a starting point, there's an "old school" CF method of form validation using hidden fields with specially formed name attributes. That should solve your problem. You can see this method described very well in the documentation.
-Cheers!

AjaxControlToolkit 7.0123 breaks UpdatePanel asynchronous post-back

I have an ASP.NET Web Application built against ASP.NET 4.5 in VS2012. Within the application are a number of forms containing ListView controls which in turn contain UpdatePanel controls so that any edit that takes place or new data that is added is carried out asynchronously and not repeated if the user refreshes the page.
This worked fine until today. Today I added the latest version of the AjaxControlToolkit (7.0123) to the project using NuGet and carried out the modifications to the scripts etc. as specified by Stephen Walther here.
Since the introduction of the AjaxControlToolkit to the project, the asynchronous post-backs appear to have become synchronous. If for example I edit an item in the ListView, when I then press F5 (in IE or Firefox) I am prompted that I will be resending the data.
The mark-up is pretty simple...
<asp:ListView ID="LocationList" runat="server" ItemType="Model.Location" DataKeyNames="ID" InsertItemPosition="LastItem" DeleteMethod="LocationList_DeleteMethod" InsertMethod="LocationList_InsertMethod" SelectMethod="LocationList_SelectMethod" UpdateMethod="LocationList_UpdateMethod">
<LayoutTemplate>
<asp:UpdatePanel ID="ListViewUpdatePanel" runat="server">
<ContentTemplate>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th runat="server">
<asp:LinkButton ID="SortByDescription" runat="server" CommandName="Sort" CommandArgument="Name" Text="Description" />
</th>
<th></th>
</tr>
</thead>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</table>
</ContentTemplate>
</asp:UpdatePanel>
<div class="pagination align-center">
<asp:DataPager runat="server" />
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<%#: Item.Name %>
</td>
<td>
<asp:LinkButton ID="Edit" runat="server" CommandName="<%#: Global.CommandNames.Edit %>" CommandArgument="<%#: Item.ID %>" Text="Edit" />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr>
<td>
<asp:TextBox ID="Description" runat="server" Text="<%#: BindItem.Name %>" />
</td>
<td>
<asp:LinkButton ID="Update" runat="server" CommandName="<%#: Global.CommandNames.Update %>" Text="Update" />
<asp:LinkButton ID="Cancel" runat="server" CommandName="<%#: Global.CommandNames.Cancel %>" Text="Cancel" />
</td>
</tr>
</EditItemTemplate>
<InsertItemTemplate>
<tr>
<td>
<asp:TextBox ID="Description" runat="server" Text="<%#: BindItem.Name %>" />
</td>
<td>
<asp:LinkButton ID="Insert" runat="server" CommandName="<%#: Global.CommandNames.Insert %>" Text="Add" />
</td>
</tr>
</InsertItemTemplate>
</asp:ListView>
The mark-up provided is within a ContentPanel and the page uses a MasterPage. The MasterPage has the ToolkitScriptManager control as outlined above.
As I have already stated, this worked fine prior to installing the AjaxControlToolkit.
I have also tried changing the layout of the page in as much as moving the UpdatePanel outside of the entire ListView (and then placing the pager under the UpdatePanel); this made no difference.
I am at a total loss as to what can be causing this other than some compatibility and/or configuration issue involving the AjaxControlToolkit. I have found other references to similar problems but I have yet to find any solution that work (for example, there are articles that indicate problems when using static client id's but as you will see from the mark-up provided I have already tried removing these and it makes no difference).

form get method not working in opera browser

Why forms submited using get method is not working in opera browser?
<form method="get" action="">
I am submiting to same page
<form method="get" action="">
<table class="search_form_table" width="428" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td width="150">Order Number</td>
<td><input name="order_number" /></td>
</tr>
<tr>
<td>Start Date</td>
<td><input class="search_date_fields" name="date_from" /> End date : <input class="search_date_fields" name="date_to" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input class="subimit_button search_button_width" type="submit" value="Submit" /></td>
</tr>
</table>
</form>
If this is the same problem I thought I had, it's not that GET doesn't work. It's because the browser hides the form name/value pairs in the query string in the Location bar. If you actually go to the location bar and hilite the URL that you submitted to, you'll see the form parameters in the query string. I hate this, but it is the way Opera does it. :-/
submitting GET forms certainly works in Opera. Copying this code to a file and submitting it creates exactly the same URL as in Chrome. Hence, your problem must be something else. Without more information it's impossible to tell what your problem really is.

IOS 5 - UIWebView duplicating requests to Rails server

I have a IOS 5 application that uses a Webview which shows some HTML received from the server.
The HTML has a form and a submit button.
The backend is a RoR 3 server.
When I click the submit button it is sending two duplicate requests to the server.
If I test the same HTML in a browser it does not send duplicate requests.
Any ideas? It is inserting two records in the DB. I want a good solution , not an unique index in the DB.
The HTML code of the page is very simple:
<html>
<body>
<div class="user_questions">
<form accept-charset="UTF-8" action="http://localhost:3000/questions/actions/sendQuestion" method="get">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓" />
</div>
<table>
<tr>
<td>
<a href="http://localhost:3000/questions/41/voteup?user_id=10&lesson_id=7&deviceName=iPhone&origin=user">
<img alt="Up" src="http://localhost:3000/assets/up.gif" />
</a>0
<a href="http://localhost:3000/questions/41/votedown?user_id=10&lesson_id=7&deviceName=iPhone&origin=user">
<img alt="Down" src="http://localhost:3000/assets/down.gif" />
</a>
</td>
<td>
Question 1
</td>
</tr>
<tr>
<td colspan="2">
<input id="userQuestion" name="userQuestion" type="text" />
</td>
<td>
<input name="commit" type="submit" value="Send" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
It is generated on the server and sent to the App via REST/Json, then setted to the webview using [webView loadHTMLString:htmlQuestions baseURL: nil];
Thanks