Solved

Need help with resolving AJAX problem...

Posted on 2009-07-08
1
433 Views
Last Modified: 2012-08-13
Hi,

I have the following ajax code (see default.aspx) that's working just fine in all non-production environments, but as soon as I deploy it to Production, I get a javascript error "  'Sys' is undefined " onload of default.aspx. Clicking "yes" to view details about the js error takes me to:

    <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$CenterMainContent$ScriptManager1', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
    </script>

Both environments are using .net 3.5 and have AJAX extensions installed. Both web configs have the lines:
      <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" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Can someone please tell me how to solve this?
Thanks a bunch.
default.aspx:

 

<%@ Page Language="C#" MasterPageFile="~/HomePage.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>

<%@ Import Namespace="System.Collections.Generic" %>

<%@ Import Namespace="System.Xml" %>

<%@ Import Namespace="System.Web" %>

<%@ Import Namespace="System.IO" %>

<%@ Import Namespace="System.Data.Common" %>

 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="slideshow" %>

 

<asp:Content ID="Content1" ContentPlaceHolderID="CenterMainContent" runat="server">

    

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

    

    <script runat="Server" type="text/C#">

    [System.Web.Services.WebMethod]

    [System.Web.Script.Services.ScriptMethod]

    public static AjaxControlToolkit.Slide[] GetSlides()

    {

        try

        {

            HttpContext context = HttpContext.Current;

            string xlsPath = context.Server.MapPath("~/uploadedFiles/slideshow.xls");

            if (File.Exists(xlsPath))

            {

                /** "HDR=Yes;" indicates that the first row contains column names/headers, not data.

                    "IMEX=1;" tells the driver to always read "intermixed" data columns as text. **/

                string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + xlsPath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";

 

                DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");

 

                List<AjaxControlToolkit.Slide> slides = new List<AjaxControlToolkit.Slide>();

 

                using (DbConnection connection = factory.CreateConnection())

                {

                    connection.ConnectionString = connectionString;

 

                    using (DbCommand command = connection.CreateCommand())

                    {

                        command.CommandText = "SELECT ImageFile, ImageTitle, ImageDesc FROM [Slides$] s WHERE LEN(LTRIM(RTRIM(ImageFile))) >= 5 AND LEN(LTRIM(RTRIM(ImageDesc))) > 0 ORDER BY ImageFile";

                        connection.Open();

                        using (DbDataReader dr = command.ExecuteReader())

                        {

                            while (dr.Read())

                            {

                                slides.Add(new AjaxControlToolkit.Slide("uploadedimages/" + dr["ImageFile"].ToString().Trim(), dr["ImageTitle"].ToString().Trim(), dr["ImageDesc"].ToString().Trim()));

                            }

                        }

                    }

                }

                return slides.ToArray();

            }

            return null;

        }

 

        catch (Exception ex)

        {

            throw ex;

        }

    }

    </script>

    

    <div id="slideShowContainer" runat="server">

        <table id="slideShow" border="0" cellpadding="0" cellspacing="0">

            <tr>

                <td>

                    <asp:Image ID="imgSlide" runat="server" ImageUrl="images/slide_Horserace.jpg" />

            

                    <slideshow:SlideShowExtender ID="SlideShowExtender1"

                      AutoPlay="true" ImageDescriptionLabelID="lblImageDescription"

                       Loop="true" NextButtonID="btnNext" PlayButtonID="btnPlay" 

                        PlayButtonText="Play" PreviousButtonID="btnPrevious" 

                        SlideShowServiceMethod="GetSlides" StopButtonText="Stop" 

                        TargetControlID="imgSlide" runat="server">

                    </slideshow:SlideShowExtender>

                </td>

            </tr>

            <tr>

                <td id="slideShowButtons">

                    <asp:ImageButton ID="btnPrevious" runat="server" ImageUrl="images/back_arrowgraphic.gif" ToolTip="Previous slide" />

                    <asp:ImageButton ID="btnPlay" runat="server" ImageUrl="images/pause_arrowgraphic.gif" ToolTip="Pause/Play" />

                    <asp:ImageButton ID="btnNext" runat="server" ImageUrl="images/forward_arrowgraphic.gif" ToolTip="Next slide" />

                    <%-- <asp:Button ID="btnPrevious" runat="server" Text="Previous" />

                    <asp:Button ID="btnPlay" runat="server" Text="Play" />

                    <asp:Button ID="btnNext" runat="server" Text="Next" /> --%>

                </td>

            </tr>

            <tr>

                <td id="slideShowText">

                    <asp:Label ID="lblImageDescription" runat="server" />

                    <br /><br />

                </td>

            </tr>

        </table>

    </div>

</asp:Content>

Open in new window

0
Comment
Question by:WebAppDeveloper
1 Comment
 
LVL 7

Accepted Solution

by:
Abu Hamdan earned 500 total points
ID: 24808340
there are lots of reasons that could cause this error, ajax extensions on server missing, ajax extensin version differ , access privilages ... etc ,,, see link below for more details:

http://66.129.67.4/t/1256133.aspx
http://forums.asp.net/t/1040236.aspx?PageIndex=1
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sum Column in GridView 3 44
Entity Framework 7 32
WCF Service Application cannot connect from TCP terminal 1 14
C# Comparing String Arrays. 5 26
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

896 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

14 Experts available now in Live!

Get 1:1 Help Now