Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...DNN, AJAX, and URL RewritingDNN, AJAX, and URL Rewriting
Previous
 
Next
New Post
5/28/2010 9:56 PM
 
We're using DotNetNuke as an internal documentation portal of sorts.  We have a proxy in front of it that perform URL rewriting.  All seemed great until we started hitting some of the more advanced parts of DNN that use AJAX calls.

Here's what is happening:

On a page with an AJAX call we get this error in IE and Firefox (although Firefox hides it in the error log by default):

Error: Sys.ScriptLoadFailedException: The script 'https://sub.contoso.com/DNNPortal/Resources/Shared/scripts/initWidgets.js' could not be loaded.
Source File: https://sub.contoso.com/2c572b4a1c6/portal1/DNNPortal/ScriptResource.axd?d=7Ja4_b1r8R8SA6876VUaxlxngSbOaU6DVT-HnP_QutYki_9pdYEh9cZDCHFf7-TVaxtq6F0x6XsYZ2O-pXaiGwlajQaaIFp30&t=ffffffffec2d9970
Line: 5


The URL that it claims couldn't be found actually hits and redirects perfectly when using a browser to address it directly.

Using fiddler to review the traffic I can see that the page call itself never ends up with a 200 status though, the traffic is a simple 1-2.

HTTP/1.1 302 Object Moved - https://sub.contoso.com/DNNPortal/Resources/Shared/scripts/initWidgets.js

HTTP/1.1 304 Not Modified - https://sub.contoso.com/2c572b4a1c6/portal1/DNNPortal//Resources/Shared/scripts/widgets.js

I'm assuming the browser/javascript engine is erroring on a not-found because of the 304 status that is returned instead of a 200 status.  Is there anything that can be done with DNN to support redirects of this sort?  Perhaps a configuration for AJAX that send the intended outside URL to the browser and avoid the redirect all together?
 
New Post
5/29/2010 12:43 PM
 
Resolved and now far more educated on http standards and javascript than I ever thought necessary.

Standards dictate that 302's be treated as a 200 status automatically.  I found tons of posts from people trying to work around this but it didn't appear that DNN was doing so.  Everything in firebug console and fiddler showed 302/304/200 status codes, nothing was being searched for and not found.

I also learned that standards dictate javascript files should notify the browser of when they're done loading.  IE and Firefox have built-in detection negating the need for this most of the time, but apparently all the redirects were throwing off the built in detection.

I opened up /Resources/Shared/scripts/initWidgets.js

Added
if( Sys && Sys.Application ){
   Sys.Application.notifyScriptLoaded();
}
to the very bottom of the script, to force a notification to the browser when the script finished loading. 

The error no longer comes up in either IE or Firefox.  Is there someplace I can submit this as a bug so it can be formally tested/added to DNN?
 
New Post
5/29/2010 1:20 PM
 
Yes, Zachary ~  If you would not mind creating an issue in our issue log at support.dotnetnuke.com, that would be great.  This is the log we use to address items in each maintenance release.

Thank you!

Scott Willhite, Co-Founder DNN

"It is only with the heart that one can see rightly... what is essential is invisible to the eye. "
~ Antoine de Saint-Exupéry

 
New Post
5/29/2010 2:32 PM
 
The other option is to hope that a member of the Maintenance team notices the forum thread and enters the support ticket for you and goes ahead and makes the code fix. ;-)

DNN-12587

Below is the updated initWidgets.js.  I have already updated the source code repository.  Please verify that this resolves your issue:

function loadWidgets()
{
    if (typeof (DotNetNuke) === "undefined")
        Type.registerNamespace("DotNetNuke.UI.WebControls");
  
    if (typeof (DotNetNuke.UI.WebControls.Utility) === "undefined")
        jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/DotNetNukeAjaxShared.js",
                    function() { jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js"); });
    else
        jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js");
}
  
if (typeof ($dnn) === "undefined") {
    $dnn = new Object();
    $dnn.pageScripts = document.getElementsByTagName("script");
    $dnn.scriptUrl = $dnn.pageScripts[$dnn.pageScripts.length - 1].src;
    $dnn.hostUrl = (typeof ($dnn.hostUrl) == "undefined" ? $dnn.scriptUrl.toLowerCase().replace("resources/shared/scripts/initwidgets.js", "") : $dnn.hostUrl);
    if (!$dnn.hostUrl.endsWith("/")) $dnn.hostUrl += "/";
    $dnn.baseDnnScriptUrl = $dnn.hostUrl + "Resources/Shared/scripts/";
    $dnn.baseResourcesUrl = $dnn.hostUrl + "Resources/";
}
  
// jQuery dependency
if (typeof (Sys) === "undefined")
    jQuery.getScript($dnn.baseDnnScriptUrl + "MSAJAX/MicrosoftAjax.js", loadWidgets());
else 
    loadWidgets();
  
if ( Sys && Sys.Application ){   
    Sys.Application.notifyScriptLoaded();
}

Joe Brinkman
DNN Corp.
 
New Post
5/29/2010 4:05 PM
 
I think that will do it - thanks!
The file I ended up with is in a slightly different order but I guess that could be due to slight version differences.  All the content appears the same to me though.

For your reference here is my final script

if (typeof ($dnn) === "undefined") {
    $dnn = new Object();
    $dnn.pageScripts = document.getElementsByTagName("script");
    $dnn.scriptUrl = $dnn.pageScripts[$dnn.pageScripts.length - 1].src;
    $dnn.hostUrl = (typeof ($dnn.hostUrl) == "undefined" ? $dnn.scriptUrl.toLowerCase().replace("resources/shared/scripts/initwidgets.js", "") : $dnn.hostUrl);
    if (!$dnn.hostUrl.endsWith("/")) $dnn.hostUrl += "/";
    $dnn.baseDnnScriptUrl = $dnn.hostUrl + "Resources/Shared/scripts/";
    $dnn.baseResourcesUrl = $dnn.hostUrl + "Resources/";
}

// jQuery dependency
if (typeof (Sys) === "undefined")
    jQuery.getScript($dnn.baseDnnScriptUrl + "MSAJAX/MicrosoftAjax.js", loadWidgets());
else
    loadWidgets();

function loadWidgets()
{
    if (typeof (DotNetNuke) === "undefined")
        Type.registerNamespace("DotNetNuke.UI.WebControls");

    if (typeof (DotNetNuke.UI.WebControls.Utility) === "undefined")
        jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/DotNetNukeAjaxShared.js",
                    function() { jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js"); });
    else
        jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js");
}

if( Sys && Sys.Application ){
   Sys.Application.notifyScriptLoaded();
}

Thanks again for getting it submitted and tested.   DNN has been great for us and now it can continue saving us from Sharepoint :)
 
Previous
 
Next
HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...DNN, AJAX, and URL RewritingDNN, AJAX, and URL Rewriting


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out