This is a migrated thread and some comments may be shown as answers.

[Solved] RadAjaxManager AjaxRequest event results in "Access is denied"

2 Answers 306 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 07 Jan 2009, 10:04 PM
I have added a RadAjaxManager to my page.  In my client-side javascript I initiate the call to the my AjaxRequest method.  After the server-side event is completed the returning response to the client generates an "Access is denied" message in the MicrosoftAjax.js file.

I have tried both an ASP.NET ScriptManager object and a RadScriptManager object with both producing the same error (it seems that the RadScriptManager uses the MicrosoftAjax.js file).

My ScriptManager is contained within a MasterPage, so my first thought was that I should move the RadAjaxManager to the MasterPage, also.  I am receiving the same error regardless of the location of the RadAjaxManager.

Here is my code to instantiate the Rad objects on the MasterPage:

 

<telerik:RadScriptManager runat="server" ID="masterScriptManager" ScriptMode="Auto">  

 

</telerik:RadScriptManager 

 

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  

 

</telerik:RadAjaxManager>

Here is my javascript on the contentpage to fire the event

 

//Initiate AJAX request to update the page  

 

 

var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");  

 

if (ajaxManager != null)  

ajaxManager.ajaxRequest();

 

 

Here is the javascript that receives the error in the MicrosoftAjax.js file:

 

Sys.Net.XMLHttpExecutor =

 

function Sys$Net$XMLHttpExecutor() {  

 

/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />  

 

 

if (arguments.length !== 0) throw Error.parameterCount();  

Sys.Net.XMLHttpExecutor.initializeBase(

this);  

 

 

 

var _this = this;  

 

this._xmlHttpRequest = null;  

 

this._webRequest = null;  

 

this._responseAvailable = false;  

 

this._timedOut = false;  

 

this._timer = null;  

 

this._aborted = false;  

 

this._started = false;  

 

this._onReadyStateChange = (function() {  

 

if (_this._xmlHttpRequest.readyState === 4) {  

 

try {  

 

if (typeof (_this._xmlHttpRequest.status) === "undefined") {  

 

return

}

 

catch (ex) { return; }

 

_this._clearTimer();

_this._responseAvailable =

true;

 

 

 

try

 

 

_this._webRequest.completed(Sys.EventArgs.Empty);

}

 

finally {              <-------------------------  Access Denied error received on this line  

 

if (_this._xmlHttpRequest != null) { 

_this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;

_this._xmlHttpRequest = n

ull;  

 

 

}

}

}

}); 

 

this._clearTimer = (function() {  

 

if (_this._timer != null) { 

window.clearTimeout(_this._timer);

_this._timer =

null;

 

 

}

}); 

 

this._onTimeout = (function() {  

 

if (!_this._responseAvailable) { 

_this._clearTimer();

_this._timedOut =

true;  

 

 

_this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;

_this._xmlHttpRequest.abort();

_this._webRequest.completed(Sys.EventArgs.Empty);

_this._xmlHttpRequest =

null;  

 

 

}

});

}

Other items of note in doing some research:

1.  There seems to be an underlying theme in the Google searches that this is a bug in the ASP.NET framework when you use frames or iframes on your webpages.  I am NOT using frames or iframes anywhere in my project.  I have also tried the modification to the MicrosoftAjax.js found at http://weblogs.asp.net/bleroy/archive/2007/01/31/how-to-work-around-the-quot-access-denied-quot-cross-domain-frame-issue-in-asp-net-ajax-1-0.aspx to no avail.

2.  Another underlying theme Google searches is cross domain issues.  Everything is running on my development workstation under the localhost domain.  This is done with the built-in web server in Visual Studio 2008.  I have also tried adjusting my security settings based on http://msdn.microsoft.com/en-us/magazine/cc301993.aspx to no avail.

3. I am using the ASP.NET 3.5 controls/framework.

4.  On the content page I have a RadGrid and RadScheduler.  Both of these have datasources that are datatables bound in the code-behind.

In summary, this issue only happens when I make a call to the AjaxRequest event attached to the RadAjaxManager.  It is very frustrating and dissappointing because the RadAjaxManager is a very powerful tool that will enhance our application, if it works properly.

Thanks in advance,

Christian

 

 

2 Answers, 1 is accepted

Sort by
0
Christian
Top achievements
Rank 1
answered on 08 Jan 2009, 03:13 PM
Nevermind, it turns out we are calling some external webservices so it is a cross-domain issue.

Thanks,

Christian
0
Monika
Top achievements
Rank 1
answered on 02 Jul 2009, 06:10 AM
Hi

I am also facing the same issue with my site. On every page where we are raising the ajax request it is giving error "Access Denied";

How did you resolve this problem?

Thanks
Monika Sharma
Tags
Ajax
Asked by
Christian
Top achievements
Rank 1
Answers by
Christian
Top achievements
Rank 1
Monika
Top achievements
Rank 1
Share this question
or