Odd script error when using client script callbacks (ASP.NET 2.0)

Discussion in 'ASP .Net' started by =?Utf-8?B?TG93bGFuZGVy?=, Mar 27, 2007.

  1. Hello,

    I've built a web application that uses client script callbacks. It is used
    on a large network with a large variety of user OSes and IE versions. It was
    tested on IE 6 on different setups and IE 5.5 to a lesser degree without
    problems.

    I know of a least one user who gets an error in WebResource.axd when using
    the application. The same error also occurs on a simple reproduction page
    with just a button and a div. When the button is pressed, the return value
    from the server is stored in the div's .innerHTML.

    In WebResource.axd the error "'encodeURIComponent' is undefined". occurs at
    the indicated line below.

    function WebForm_EncodeCallback(parameter) {
    if (encodeURIComponent) { <--------------------------------- here.
    return encodeURIComponent(parameter);
    }
    else {
    return escape(parameter);
    }
    }

    I've been able to reproduce the error on a virtual machine running Windows
    2000 with IE 5. The user involved however is using Windows 2000 with IE 6
    (6.0.2800.1106co). I've tried searching for some text that explains why this
    could be happening, but have come up empty. So if anyone is familiar with
    this or knows the reason this could be happening I'd be glad to know.

    Below I'll add the code for the reproduction page and codebehind.

    Webform:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="Web._Default" %>

    <!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>Client callback test pagina</title>
    <script language="javascript">
    function ProcessReturnValue(response, context)
    {
    var textArea = document.getElementById("textArea");
    textArea.innerHTML = response;
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <p>
    <input id="callbackButton" type="button" value="Server aanroepen"
    runat="server" />
    </p>
    <div>
    <div id="textArea" style="border: solid 1px black; height:
    100px;"></div>
    </div>
    </form>
    </body>
    </html>

    Codebehind:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    namespace Web
    {
    public partial class _Default : System.Web.UI.Page, ICallbackEventHandler
    {
    private string _result = "";

    protected void Page_Load(object sender, EventArgs e)
    {
    string rpc = ClientScript.GetCallbackEventReference(this, null,
    "ProcessReturnValue", "null", "null", false);
    string js = String.Format("javascript:{0}", rpc);
    callbackButton.Attributes["onclick"] = js;
    }

    #region ICallbackEventHandler Members

    public void RaiseCallbackEvent(string eventArgument)
    {
    _result = "Text returned from the server.";
    }

    public string GetCallbackResult()
    {
    return _result;
    }

    #endregion
    }
    }
     
    =?Utf-8?B?TG93bGFuZGVy?=, Mar 27, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Tam

    Client Side Callbacks for ASP.NET 1.x

    Lucas Tam, Feb 1, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    1,346
    Jeff @ Dart
    Feb 7, 2005
  2. =?Utf-8?B?TWljaGFlbFk=?=

    ASP.NET ICallbackHandler - Script callbacks....

    =?Utf-8?B?TWljaGFlbFk=?=, Jan 21, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,943
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 22, 2006
  3. aBs0lut30
    Replies:
    0
    Views:
    305
    aBs0lut30
    Aug 10, 2006
  4. =?Utf-8?B?QU5lZWxpbWE=?=
    Replies:
    1
    Views:
    373
    bruce barker
    Oct 1, 2007
  5. Ryan Liu
    Replies:
    1
    Views:
    645
    Alexey Smirnov
    Mar 17, 2009
Loading...

Share This Page