dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: AJAX Not Working from One Server to the Next

  1. #1
    Join Date
    Oct 2017
    Posts
    5

    AJAX Not Working from One Server to the Next

    Hello,

    I have a page with a basic modal popup. The code is as follows:
    Code:
    <%@ Page Title="" Language="VB" MasterPageFile="~/re.master" AutoEventWireup="false" CodeFile="addproperty.aspx.vb" Inherits="Register_default" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <title>Admin - Add Property</title>
        <style>
        .modalBackground{
            background-color:black;
            filter:alpha(opacity=90) !important;
            opacity:0.6 !important;
            z-index:20;
        }
        .modalpopup{
            padding:30px 10px 30px 10px;
            position:relative;
            width:550px;
            height:100px;
            background-color:white;
            border:1px solid black;
        }
        </style>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <!--============================== slider =================================-->
        <div class="row_6">
            <div class="container">
                <div class="row">
                    <div class="span8">
                    <h2>Add Property</h2>
                        <div id="contact-form" class="contact-form">
                          <div><asp:Label ID="lblMessage" runat="server" Font-Bold="true" Text=""></asp:Label></div>
                          <fieldset>
                              <div class="coll-1">
                                <p>Address*</p>
                                <label class="address">
                                    <asp:TextBox ID="txtAddress" runat="server" MaxLength="100"></asp:TextBox><br />
                                    <span id="emptyaddress" runat="server" style="color:#f00; font-size:10px; line-height:1.2em; text-align:right; overflow:hidden; width:100%; text-transform:none; position:relative; left:650px; display:none;">*This field is required.</span>
                                </label>
                              </div>
                              <div class="coll-2">
                                <p>City / State*</p>
                                <label class="city">
                                    <asp:TextBox ID="txtCity" runat="server" MaxLength="100"></asp:TextBox>&nbsp;<asp:DropDownList ID="ddlState" runat="server"></asp:DropDownList><br />
                                    <span id="emptycity" runat="server" style="color:#f00; font-size:10px; line-height:1.2em; text-align:right; overflow:hidden; width:100%; text-transform:none; position:relative; left:650px; display:none;">*This field is required.</span>
                                </label>
                              </div>
                              <div class="coll-3">
                                <p>Zip Code*</p>
                                <label class="zipcode">
                                    <asp:TextBox ID="txtZipCode" runat="server" MaxLength="10"></asp:TextBox><br />
                                    <span id="emptyzip" runat="server" style="color:#f00; font-size:10px; line-height:1.2em; text-align:right; overflow:hidden; width:100%; text-transform:none; position:relative; left:650px; display:none;">*This field is required.</span>
                                </label>
                              </div>
                              <div class="clear"></div>
                              <div class="coll-1">
                                <p>Status*</p>
                                <label class="status">
                                    <asp:DropDownList ID="ddlStatus" runat="server"></asp:DropDownList>
                                </label>
                              </div>
                              <div class="clear"></div>
                              <div>
                                  <p>Description</p>
                                  <label class="description">
                                    <asp:TextBox ID="txtDescription" TextMode="MultiLine" runat="server"></asp:TextBox>                                
                                </label>
                              </div>
                              <div class="clear"></div>
                              <div class="buttons-wrapper clearfix"><asp:LinkButton ID="lbSave" Class="btn link2" data-type="submit" runat="server">Save Property</asp:LinkButton><span>*required fields</span></div>
                            </fieldset>
                        </div>
                    </div>
                    <div class="span4">
                        <h2>Menu</h2>
                        <ul class="list2 clearfix">
                            <% ShowAdminSubMenu(Session("AccountTypeID")) %>
                        </ul>
                    </div>
                </div>
            </div>   
        </div>
        <asp:Button ID="Button1" runat="server" style="display:none" Text="" />
        <asp:Panel ID="Panel1" runat="server" CssClass="modalpopup">
            <asp:Label ID="lblmodalMsg" runat="server" Text=""></asp:Label>
            <div style="width:100%; text-align:center"><asp:LinkButton ID="LinkButton2" Class="btn link2" data-type="submit" runat="server">Create Another Work Order</asp:LinkButton>
            <asp:LinkButton ID="LinkButton3" Class="btn link2" data-type="submit" runat="server">Return to Work Orders</asp:LinkButton></div>
        </asp:Panel>
        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Button1" BackgroundCssClass="modalBackground"></ajaxToolkit:ModalPopupExtender>
    </asp:Content>
    This code had been working fine for months, however, I recently moved the site to a new host and now the modal popup appears at the bottom of the page. See below:

    Name:  modalpop_err.jpg
Views: 450
Size:  8.4 KB

    The new host claims they support AJAX and have verified for me that AJAX is "enabled" on the server, but clearly there's something different between the 2 hosts? When I transferred my site, they did force me to comment out a number of lines in the web.config file. The web.config now looks like the following:

    Code:
    <?xml version="1.0"?>
    
    <configuration>
        <configSections>
          <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
              <!--<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>-->
              <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <!--<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />-->
                <!--<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />-->
                <!--<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />-->
                <!--<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />-->
              </sectionGroup>
            </sectionGroup>
          </sectionGroup>
        </configSections>
        <appSettings/>
        <connectionStrings>
          <clear/>
          <add name="strDBConnection" connectionString="Data Source=db123456.db.1and1.com; Initial Catalog=db9876543; User ID=dboTEST; Password=SORRY!"/>
        </connectionStrings>
        <system.web>
          <httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
            <!-- 
                Visual Basic options:
                Set strict="true" to disallow all data type conversions 
                where data loss can occur. 
                Set explicit="true" to force declaration of all variables.
            -->
            <compilation debug="true" strict="false" explicit="true">
              <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
              </assemblies>
            </compilation>
            <!--
              The <authentication> section enables configuration 
              of the security authentication mode used by 
              ASP.NET to identify an incoming user. 
            -->
            <authentication mode="Windows" />
            <customErrors mode="Off"/>  
          <!--
               The <customErrors> section enables configuration 
               of what to do if/when an unhandled error occurs 
               during the execution of a request. Specifically, 
               it enables developers to configure html error pages 
               to be displayed in place of a error stack trace.
    
               <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                 <error statusCode="403" redirect="NoAccess.htm" />
                 <error statusCode="404" redirect="FileNotFound.htm" />
               </customErrors>
            -->
            <pages>
              <namespaces>
                <clear />
                <add namespace="System" />
                <add namespace="System.Collections" />
                <add namespace="System.Collections.Generic" />
                <add namespace="System.Collections.Specialized" />
                <add namespace="System.Configuration" />
                <add namespace="System.Text" />
                <add namespace="System.Text.RegularExpressions" />
                <add namespace="System.Linq" />
                <add namespace="System.Xml.Linq" />
                <add namespace="System.Web" />
                <add namespace="System.Web.Caching" />
                <add namespace="System.Web.SessionState" />
                <add namespace="System.Web.Security" />
                <add namespace="System.Web.Profile" />
                <add namespace="System.Web.UI" />
                <add namespace="System.Web.UI.WebControls" />
                <add namespace="System.Web.UI.WebControls.WebParts" />
                <add namespace="System.Web.UI.HtmlControls" />
              </namespaces>
              <controls>
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <!--<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>-->
                <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
              </controls>
            </pages>
          <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
          </httpHandlers>
          <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </httpModules>
        </system.web>
        <system.codedom>
          <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
                      type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
              <providerOption name="CompilerVersion" value="v3.5"/>
              <providerOption name="WarnAsError" value="false"/>
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
                      type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
              <providerOption name="CompilerVersion" value="v3.5"/>
              <providerOption name="OptionInfer" value="true"/>
              <providerOption name="WarnAsError" value="false"/>
            </compiler>
          </compilers>
        </system.codedom>
        <!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
        <system.webServer>
          <security>
            <requestFiltering>
              <requestLimits maxAllowedContentLength="1073741824" />
            </requestFiltering>
          </security>
          <validation validateIntegratedModeConfiguration="false"/>
          <modules>
            <remove name="ScriptModule" />
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </modules>
          <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory" />
            <remove name="ScriptHandlerFactoryAppServices" />
            <remove name="ScriptResource" />
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </handlers>
          <staticContent>
            <remove fileExtension=".woff" />
            <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
          </staticContent>
          <defaultDocument enabled="true">
            <files>
              <clear/>
              <add value="default.aspx" />
              <add value="index.aspx" />
              <add value="index.html" />
            </files>
          </defaultDocument>
        </system.webServer>
        <runtime>
          <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
          </assemblyBinding>
        </runtime>
    
    </configuration>
    Any help you can provide as to why AJAX is not working is greatly appreciated!

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,700

    Re: AJAX Not Working from One Server to the Next

    Is the old site still available? If so, comment out the same lines in the config file and see if it breaks ajax on the old site.

  3. #3
    Join Date
    Oct 2017
    Posts
    5

    Re: AJAX Not Working from One Server to the Next

    Quote Originally Posted by Arjay View Post
    Is the old site still available? If so, comment out the same lines in the config file and see if it breaks ajax on the old site.
    Excellent idea! The old site is still available, so I did exactly as you suggested, but the AJAX still worked, so I guess it is not the web.config. Any other thoughts?

  4. #4
    Join Date
    Oct 2017
    Posts
    5

    Re: AJAX Not Working from One Server to the Next

    Just a heads up, this issue was never resolved. I ended up moving my site to another host. I have determined that 1and1 does NOT support AJAX despite claiming to do so on their Windows hosting packages.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)