Bobby X
asked on
Need help with resolving AJAX problem...
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.PageRequestMa nager._ini tialize('c tl00$Cente rMainConte nt$ScriptM anager1', document.getElementById('a spnetForm' ));
Sys.WebForms.PageRequestMa nager.getI nstance(). _updateCon trols([], [], [], 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.Se rvices.Scr iptHandler Factory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD3 64E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers. ScriptReso urceHandle r, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD3 64E35" validate="false" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Se rvices.Scr iptHandler Factory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad3 64e35" />
Can someone please tell me how to solve this?
Thanks a bunch.
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.PageRequestMa
Sys.WebForms.PageRequestMa
//]]>
</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.Se
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Se
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>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.