Solved

ajax not working in asp

Posted on 2009-05-05
3
580 Views
Last Modified: 2012-05-06
I have a much bigger swork site I am trying to get working involving a chat system, but I am just doing this small example becuae I cannot get the ajax to work correctly.  I keep getting the error "asp .net ajax client-side framework failed toad"  and "Sys is undefined"  I have been googling this and most things point to the web.config file, but I still cannot get it working.  I also just repaired my ASP 3.5 sp1.
Default3.aspx:
 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <script type="text/javascript">

    

      function pageLoad() {

      }

    

    </script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:ScriptManager ID="ScriptManager1" EnablePageMethods='true' runat="server" />

        <br />

        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        <br />

        <br />

        <br />

        <br />

        <br />

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">

            <ContentTemplate>

                <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>

                <br />

                <br />

                <br />

                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

            </ContentTemplate>

        </asp:UpdatePanel>

        <br />

        <br />

    </div>

    </form>

</body>

</html>
 
 
 

Default3.aspx.cs:
 

using System;

using System.Collections.Generic;
 

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;
 

public partial class Default3 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        Label1.Text = DateTime.Now.ToString();
 

        Label2.Text = DateTime.Now.ToString();
 

    }

    protected void Button1_Click(object sender, EventArgs e)

    {
 

    }

}
 
 
 

WEB.CONFIG:
 

<?xml version="1.0"?>

<configuration>

<system.web>
 

    <pages>
 

      <controls>

        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

      </controls>

    </pages>
 

   

    

		<!--  DYNAMIC DEBUG COMPILATION

          Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to

          false will improve runtime performance of this application. 

          Set compilation debug="true" to insert debugging symbols (.pdb information)

          into the compiled page. Because this creates a larger file that executes

          more slowly, you should set this value to true only when debugging and to

          false at all other times. For more information, refer to the documentation about

          debugging ASP.NET files.

    -->

		<compilation defaultLanguage="c#" debug="true">

			<compilers>

				<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs" compilerOptions="/d:DEBUG;TRACE"/>

      </compilers>
 

 

      <assemblies>

				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

				<add assembly="System.Runtime.Serialization.Formatters.Soap, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

				<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation>

		<!--  CUSTOM ERROR MESSAGES

          Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. 

          Add <error> tags for each of the errors you want to handle.
 

          "On" Always display custom (friendly) messages.

          "Off" Always display detailed ASP.NET error information.

          "RemoteOnly" Display custom (friendly) messages only to users not running 

           on the local Web server. This setting is recommended for security purposes, so 

           that you do not display application detail information to remote clients.

    -->

		<customErrors mode="RemoteOnly"/>

		<!--  AUTHENTICATION 

          This section sets the authentication policies of the application. Possible modes are "Windows", 

          "Forms", "Passport" and "None"
 

          "None" No authentication is performed. 

          "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to 

           its settings for the application. Anonymous access must be disabled in IIS. 

          "Forms" You provide a custom form (Web page) for users to enter their credentials, and then 

           you authenticate them in your application. A user credential token is stored in a cookie.

          "Passport" Authentication is performed via a centralized authentication service provided

           by Microsoft that offers a single logon and core profile services for member sites.

    -->

		<authentication mode="Windows"/>

		<!--  AUTHORIZATION 

          This section sets the authorization policies of the application. You can allow or deny access

          to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous 

          (unauthenticated) users.

    -->

		<authorization>

			<allow users="*"/>

			<!-- Allow all users -->

			<!--  <allow     users="[comma separated list of users]"

                             roles="[comma separated list of roles]"/>

                  <deny      users="[comma separated list of users]"

                             roles="[comma separated list of roles]"/>

            -->

		</authorization>

		<!--  APPLICATION-LEVEL TRACE LOGGING

          Application-level tracing enables trace log output for every page within an application. 

          Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the

          trace information will be displayed at the bottom of each page.  Otherwise, you can view the 

          application trace log by browsing the "trace.axd" page from your web application

          root. 

    -->

		<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>

		<!--  SESSION STATE SETTINGS

          By default ASP.NET uses cookies to identify which requests belong to a particular session. 

          If cookies are not available, a session can be tracked by adding a session identifier to the URL. 

          To disable cookies, set sessionState cookieless="true".

    -->

		<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>

		<!--  GLOBALIZATION

          This section sets the globalization settings of the application. 

    -->

		<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

		<xhtmlConformance mode="Legacy"/></system.web>

</configuration>

Open in new window

0
Comment
Question by:wizkid2332
3 Comments
 
LVL 3

Expert Comment

by:RobbP
Comment Utility
Try adding the controls into the web.connfig, eg:

<pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="ajaxToolkit" namespace="AjaxNamespace" assembly="AjaxAssemblyName"/>
      </controls>
    </pages>

Alternatively add a reference within your control/page using a directive - just to pinpoint where the issue liies:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

Also check the versioning and the GAC (ie that any previous versions werent GAC'd or that strong naming might be required.
0
 
LVL 4

Accepted Solution

by:
jwmcpeak earned 125 total points
Comment Utility
What generated your web.config? The  element belongs under  not  under . I also don't see an , which is needed for the script module. The following is one from one of my Ajax-enabled projects. It's 3.5, not 3.5 SP1, but it should still work.
<?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>

    <system.web>

        <pages>

            <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"/>

            </controls>

        </pages>

        <!--

          Set compilation debug="true" to insert debugging

          symbols into the compiled page. Because this

          affects performance, set this value to true only

          during development.

    -->

        <compilation debug="true">

            <assemblies>

                <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

                <add assembly="System.Core, 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"/>

                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

            </assemblies>

        </compilation>

        <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.web.extensions>

        <scripting>

            <webServices>

                <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->

                <!--

      <jsonSerialization maxJsonLength="500">

        <converters>

          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

        </converters>

      </jsonSerialization>

      -->

                <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->

                <!--

        <authenticationService enabled="true" requireSSL = "true|false"/>

      -->

                <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved

           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and

           writeAccessProperties attributes. -->

                <!--

      <profileService enabled="true"

                      readAccessProperties="propertyname1,propertyname2"

                      writeAccessProperties="propertyname1,propertyname2" />

      -->

            </webServices>

            <!--

      <scriptResourceHandler enableCompression="true" enableCaching="true" />

      -->

        </scripting>

    </system.web.extensions>

    <system.webServer>

        <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="ScriptHandlerFactory"/>

            <remove name="ScriptHandlerFactoryAppServices"/>

            <remove name="ScriptResource"/>

            <remove name="WebServiceHandlerFactory-Integrated"/>

            <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>

    </system.webServer>

    <system.codedom>

        <compilers>

            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">

                <providerOption name="CompilerVersion" value="v3.5"/>

                <providerOption name="WarnAsError" value="false"/>

            </compiler>

            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">

                <providerOption name="CompilerVersion" value="v3.5"/>

                <providerOption name="OptionInfer" value="true"/>

                <providerOption name="WarnAsError" value="false"/>

            </compiler>

        </compilers>

    </system.codedom>

    <runtime>

        <assemblyBinding 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>

Open in new window

0
 

Author Closing Comment

by:wizkid2332
Comment Utility
Thanks so much--I just copied your web.config file over and it all works!!  I appreciate it!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to count occurrences of each item in an array.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now