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

G

Guest

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top