By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,028 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,028 IT Pros & Developers. It's quick & easy.

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

P: n/a

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

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.


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" >
<head runat="server">
<title>Client callback test pagina</title>
<script language="javascript">
function ProcessReturnValue(response, context)
var textArea = document.getElementById("textArea");
textArea.innerHTML = response;
<form id="form1" runat="server">
<input id="callbackButton" type="button" value="Server aanroepen"
runat="server" />
<div id="textArea" style="border: solid 1px black; height:


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;

Mar 27 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.