Can anyone explain to me why my page source code changes when i upload it to my webserver from:
To:
And my form doesnt work properly. It completes and submits fine but no emails are getting sent and it doesnt refresh back to home page as it should because it adds the page twice rather then the original code.
So this
becomes
Code:
<form runat="server" >
<table width="430" border="0" cellspacing="9" cellpadding="0">
<tr>
<td width="85"b class="contactformfieldheader">Name:</td>
<td width="339"><asp:TextBox ID="txtName" runat="server" Columns="55"
CssClass="contactformfieldtext" /></td>
</tr>
<tr>
<td class="contactformfieldheader">Telephone:</td>
<td><asp:TextBox ID="txtPhone" runat="server" Columns="55"
CssClass="contactformfieldtext" ValidationGroup="Contact"></asp:TextBox></td>
</tr>
<tr>
<td class="contactformfieldheader">Email: *</td>
<td><asp:TextBox ID="txtEmail" runat="server" Columns="55"
CssClass="contactformfieldtext" ValidationGroup="Contact"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="rfvEmail" runat="server"
ControlToValidate="txtEmail" Display="Dynamic" Font-Names="Arial"
Font-Size="8pt" Text="You must specify an email address" ValidationGroup="Contact"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="revEmail" runat="server"
ControlToValidate="txtEmail" Display="Dynamic" Font-Names="Arial"
Font-Size="8pt" Text="Not a valid email address"
ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$" ValidationGroup="Contact"></asp:RegularExpressionValidator></td>
</tr>
<tr>
<td valign="top" class="contactformfieldheader">Comments:</td>
<td><asp:TextBox ID="txtComments" runat="server" Columns="52"
CssClass="contactformfieldtext" Rows="7" TextMode="MultiLine" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><asp:Button CssClass="contacttextheaderred" ID="cmd_Send" runat="server" Text="Submit" ValidationGroup="Contact" OnClick="cmd_Send_Click" /></td>
</tr>
</table>
</form>
</asp:Panel>
<asp:Panel id="panelMailSent" runat="server" Visible="False" CssClass="bodytext">
Thank you.
Your email has been sent to me. I will be in contact with you shortly.
</asp:Panel>
To:
Code:
<form name="ctl00" method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="ctl00">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzAzNDY0MDY2ZGRH1uMTJsyUinpA35AWIlR8WcYM5w==" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['ctl00'];
if (!theForm) {
theForm = document.ctl00;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=jw_cUcOEVL-yQuaAddGSCg2&t=634091085123982252" type="text/javascript"></script>
<script src="/WebResource.axd?d=rXjRDbuuhOcf6TBAeppNGBTmjvTmhwLqo26VIn9u6As1&t=634091085123982252" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
<table width="430" border="0" cellspacing="9" cellpadding="0">
<tr>
<td width="85"b class="contactformfieldheader">Name:</td>
<td width="339"><input name="txtName" type="text" size="55" id="txtName" class="contactformfieldtext" /></td>
</tr>
<tr>
<td class="contactformfieldheader">Telephone:</td>
<td><input name="txtPhone" type="text" size="55" id="txtPhone" class="contactformfieldtext" /></td>
</tr>
<tr>
<td class="contactformfieldheader">Email: *</td>
<td><input name="txtEmail" type="text" size="55" id="txtEmail" class="contactformfieldtext" />
<br />
<span id="rfvEmail" style="color:Red;font-family:Arial;font-size:8pt;display:none;">You must specify an email address</span>
<span id="revEmail" style="color:Red;font-family:Arial;font-size:8pt;display:none;">Not a valid email address</span></td>
</tr>
<tr>
<td valign="top" class="contactformfieldheader">Comments:</td>
<td><textarea name="txtComments" rows="7" cols="52" id="txtComments" class="contactformfieldtext"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="cmd_Send" value="Submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("cmd_Send", "", true, "Contact", "", false, false))" id="cmd_Send" class="contacttextheaderred" /></td>
</tr>
</table>
<script type="text/javascript">
//<![CDATA[
var Page_Validators = new Array(document.getElementById("rfvEmail"), document.getElementById("revEmail"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var rfvEmail = document.all ? document.all["rfvEmail"] : document.getElementById("rfvEmail");
rfvEmail.controltovalidate = "txtEmail";
rfvEmail.display = "Dynamic";
rfvEmail.validationGroup = "Contact";
rfvEmail.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
rfvEmail.initialvalue = "";
var revEmail = document.all ? document.all["revEmail"] : document.getElementById("revEmail");
revEmail.controltovalidate = "txtEmail";
revEmail.display = "Dynamic";
revEmail.validationGroup = "Contact";
revEmail.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
revEmail.validationexpression = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
//]]>
</script>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBgLR3vL6CQLEhISFCwLEku2wCAKE8/26DAL/94HMDALcwKbcBGVFJITjwaYypnkDzhrmEJsmFjJm" />
</div>
<script type="text/javascript">
<!--
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
// -->
</script>
</form>
And my form doesnt work properly. It completes and submits fine but no emails are getting sent and it doesnt refresh back to home page as it should because it adds the page twice rather then the original code.
So this
Code:
Response.AddHeader ("Refresh","5;URL=index.aspx")
becomes
Code:
/index.aspx, 5;URL=index.aspx