PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Dot.Net <form> inserting in the wrong place in html template.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dot.Net <form> inserting in the wrong place in html template.

    Hi,
    I have been using V6 of the ASPX Server Control on my site now for a few years. It has been quite successful and I have been very pleased with it. I thought I would go ahead and upgrade to V7, just to be up-to-date.

    I have installed V7 on my test server and noticed a problem with the styling on my existing template. I went back and applied the default template and looked at the resulting generated ASPX page.

    It seems that for some reason the control is inserting the <form> at the very beginning of the page... even before the !DOCTYPE declaration. While it seems "work" in my test environment, my server administrator says that this is a mal-formed page and would be a concern to put into production this way. He says the <form> must be inserted inside the <body> of the document.

    Am I doing something wrong?

    Here is a clip from the resulting aspx page....
    --------------------------------------------------------------
    <form method="post" action="search.aspx?zoom_sort=0&amp;zoom_xml=0&amp ;zoom_query=hk" id="form1">
    <div class="aspNetHidden">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTYzMDI3NTc3N2RkAGmJ9riOpcvpJIECXEJgBGeF5yg nx7KTYwmhiqXgrVI=" />
    </div>

    <div class="aspNetHidden">

    <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="7BAD5775" />
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    </div>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!--
    This is the search template file (search_template.html) which contains the layout
    to your search page.

    Note that you can not access the search function from this page. Instead,
    you should open or link to the search script, which is a file named "search.php",
    "search.asp", or "search.cgi".
    -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>......

  • #2
    First of all, to quickly restore the previous (V6) behaviour with the ASP.NET control, go to "Configure"->"Search Page" and uncheck "Use PostBack for search options" and also check "Generate <form> tags for search form". This would disable the postback mechanisms and simply generate the form as where indicated by the <!--ZOOMSEARCH--> tag in your search_template.html file.

    For many ASP.NET sites though, they want to retain the postback mechanism. In such cases, they would have the inverse of these settings and alter the "search.aspx" page to match their site, and remove most content from "search_template.html" (except for the <!--ZOOMSEARCH--> tag).

    I hope this helps. Let us know if you still have trouble.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      We are having the same issue. We are on V6.0 Build 1029. Went to the Configure Search Page tab as recommended and the options described above do not appear.. Attached is a screen capture. Please advise how to stop ASP.NET Control from inserting <form> tags as our master page contains an encompassing form (and must, because we have input fields in the header for other functions, etc)

      Our content page appears as follows:

      <%@ Page Language="C#" ValidateRequest="true" Debug="true" Title="xxxx" CodeFile="search.aspx.cs" Inherits="xxx.search" CodePage="65001" MasterPageFile="/xxx.master" %>

      <%@ Register TagPrefix="ZoomASPX" Namespace="ZoomASPX" Assembly="ZoomASPX" %>

      <asp:Content ID="Content3" ContentPlaceHolderID="bodyContent" runat="server">
      <div class="row">
      <div class="col-md-10 col-md-offset-1 col-xs-11 col-xs-offset-1">
      <div class="article">
      <ZoomASPX:ASPXSearch id="ASPXSearch" runat="server" />
      </div>
      </div>
      </div>
      <div class="row">
      <div class="col-md-10 col-md-offset-1 col-xs-11 col-xs-offset-1">&nbsp;</div>
      </div>
      </asp:Content>



      The server control is generating:

      <form method="get" action="search.aspx" class="zoom_searchform">
      <input type="hidden" name="zoom_sort" value="0" />
      <input type="hidden" name="zoom_xml" value="0" />
      Search for: <input type="text" name="zoom_query" size="20" value="" id="zoom_searchbox" class="zoom_searchbox" />
      <input type="submit" value="Submit" class="zoom_button" />
      <span class="zoom_results_per_page">Results per page:
      <select name="zoom_per_page">
      <option selected="selected">10</option>
      <option>20</option>
      <option>50</option>
      <option>100</option>
      </select><br /><br /></span>
      <span class="zoom_match">Match:
      <input type="radio" name="zoom_and" value="0" checked="checked" />any search words
      <input type="radio" name="zoom_and" value="1" />all search words
      <br /><br /></span>
      </form>

      The error we receive when searching from the search form:
      The state information is invalid for this page and might be corrupted.

      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

      Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.

      Source Error:

      [No relevant source lines]
      Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temp orary ASP.NET Files\root\1ab23778\781767d5\App_Web_hlvnuqbs.0.cs Line: 0

      Stack Trace:

      [ViewStateException: Invalid viewstate. Client IP: 47.150.33.175 Port: 52876 Referer: http://mtest.dgxglobal.com/search/search.aspx Path: /search/search.aspx User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 ViewState: wySgAg4JnqdMZ1n4tK1WQBEJ0kRYf/2Ubb7AkTq5Rcgd/rQf3ELwAdjaxtA+zEX42okUmxy8LuBHGU5xTM2EMsDM5Oss7/Qm8XV/+PcAHajy8UXCTmpCSwi+eQ1+imCuS6mliAh2t2CiV85SbvmPVg ==] [HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] System.Web.UI.ViewStateException.ThrowError(Except ion inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116 System.Web.UI.ClientScriptManager.EnsureEventValid ationFieldLoaded() +9847715 System.Web.UI.ClientScriptManager.ValidateEvent(St ring uniqueId, String argument) +63 System.Web.UI.WebControls.TextBox.LoadPostData(Str ing postDataKey, NameValueCollection postCollection) +126 System.Web.UI.WebControls.TextBox.System.Web.UI.IP ostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13 System.Web.UI.Page.ProcessPostData(NameValueCollec tion postData, Boolean fBeforeLoad) +303 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245 System.Web.UI.Page.ProcessRequest() +72 System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +58 ASP.search_search_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temp orary ASP.NET Files\root\1ab23778\781767d5\App_Web_hlvnuqbs.0.cs :0 System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +341 System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +69
      It won't let me add the attachment to show you that none of the options described show on the referenced page...


      Comment


      • #4
        Originally posted by steve@nolimitsinteractive View Post
        We are having the same issue. We are on V6.0 Build 1029. Went to the Configure Search Page tab as recommended and the options described above do not appear..
        The option I mentioned above was for V7. The original poster was upgrading from V6 to V7 and found a difference in behaviour -- and he wanted the old V6 behaviour where the <form> tag is inserted within the <body> ... which is the opposite of what you want.

        There are various ways to use ASP.NET which does not involve a master page, and that's what V6 supported. If you are using a master page, you should upgrade to V7.

        Originally posted by steve@nolimitsinteractive View Post
        Attached is a screen capture. Please advise how to stop ASP.NET Control from inserting <form> tags as our master page contains an encompassing form (and must, because we have input fields in the header for other functions, etc)
        This is best supported in V7 -- there are various options to enable it for master pages, PostBack and Viewstate support (more details here). You should upgrade to the latest version, information here:
        http://www.wrensoft.com/sales/upgrades.php

        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment

        Working...
        X