Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code changes

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
Can anyone explain to me why my page source code changes when i upload it to my webserver from:

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
 
Thanks for your response.

I just find it strange that I dont remember seeing this much code before and my code has always work and all of a sudden it doesnt work.

And nothing has changed with the server environment.
 
I just find it strange that I dont remember seeing this much code before
do you understand how html engines work? this is, after all, what webforms is; an html view engine.

when you say "it always worked" do you mean locally on development, or on the production server? if you mean locally, then yes it makes sense that it wouldn't work once deployed. local development vs the production server are drastically different environments and there are many bugs that could show up in production because they were not accounted for in development.

if you mean it always worked on the server then you need to figure out what changed.
1. application configuration
2. application code
3. IIS server configuration
4. email server configuration

if you have a logging in place review the logs to see what is happening. If not I would recommend putting logging in place so you can log the health of your application.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top