Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Reference to JS file prompts logon View modes: 
User avatar
Member
Member
_charleswesley - 1/31/2014 6:32:24 PM
   
Reference to JS file prompts logon
I want to reference a javascript file at the bottom of a page template.

I added the .js file under cmssitemanager / development / javascript files and then added the following to the master template (portal engine):

<script src="/CMSScripts/Custom/FOO/BAR.js"></script>

When I open the page in any browser, the javascript in the file isn't executing.

When I go to http://domain.com/CMSScripts/Custom/FOO/BAR.js I get redirected to the Kentico logon page.

I don't see how/where I can specify security for the CMSScripts directory, but the user should not have to be logged in to access this file.

Any suggestions?

User avatar
Member
Member
kentico_sandroj - 1/31/2014 9:15:36 PM
   
RE:Reference to JS file prompts logon
Hello,

If you are using windows authentication please check for any location attributes that could be blocking access to the file. Please also check the disk permissions and let us know if the issue persists.

Best Regards,
Sandro

User avatar
Member
Member
_charleswesley - 2/4/2014 4:18:21 PM
   
RE:Reference to JS file prompts logon
We are not using Windows Authentication on this site, and the disk permissions are correct. I verified that the application pool user account has permission on the file system and I also ran the "test files" module in the site manager and recorded the following response:

Creating '~/CMSSiteUtils/TestFiles/TestFolder201424141436/' - OK

Creating '~/CMSSiteUtils/TestFiles/TestFolder201424141436/TestFile201424141436.txt' - OK

Deleting '~/CMSSiteUtils/TestFiles/TestFolder201424141436/TestFile201424141436.txt' - OK

Deleting '~/CMSSiteUtils/TestFiles/TestFolder201424141436/' - OK

Modifying '~/CMSSiteUtils/TestFiles/TestModify.txt' - OK

User avatar
Member
Member
_charleswesley - 2/4/2014 4:38:11 PM
   
RE:Reference to JS file prompts logon
Also here is some additional context.

User avatar
Kentico Legend
Kentico Legend
Accepted solutionAccepted solution
Brenden Kehren - 2/6/2014 6:48:52 AM
   
RE:Reference to JS file prompts logon
_charleswesley wrote:
<script src="/CMSScripts/Custom/FOO/BAR.js"></script>
Any suggestions?
You're best bet is to use the syntax below. Kentico does URL processing on all directories unless excluded and you'd have to exclude the CMSScripts directory from processing which isn't hard but the code below is a better solution.
<script src="/CMSPages/GetResource.ashx?scriptfile=/CMSScripts/Custom/FOO/BAR.js" type="text/javascript"></script>
This will do 2 things:
1) give you a standard place to call resources from (you can get stylesheets here as well)
2) allow you to use the build-in minimization functions.

User avatar
Member
Member
_charleswesley - 2/6/2014 11:10:23 AM
   
RE:Reference to JS file prompts logon
My man that did the trick, if I ever run into you at a conference I owe you a beer of your choice. Thank you!