My question has to do with grabbing all the active users on my site. Below are the specs:
IIS Version: IIS 8.5
Server: Windows Server 2012 R2
Root folder: D:\Sites\Default\WWWRoot
Site Directory: D:\Sites\Default\WWWRoot\Website
Website is the directory where all the pages are stored. This is also the page that is listed as the Default App Pool in IIS. Classic ASP is the default language we are using.
Recently, my manager asked that we grab the active users currently hitting our site on the index of the page and display it.
So I made a file called Global.asa in the WWWRoot Folder (not the Website directory) and this is the contents of the asa file:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
application("activevisitors")=0
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
application.lock
application("activevisitors")=application("activevisitors")+1
application.unlock
End Sub
Sub Session_OnEnd
application.lock
application("activevisitors")=application("activevisitors")-1
application.unlock
End Sub
</SCRIPT>
And in the Websites directory where all the site pages are stored, I have an index.asp file that has the below added:
There are <% response.write(application("activevisitors")) %> active visitors
When I load index.asp, it gives me "There are active visitors." but no numbers or count like its supposed to do. Here are my questions
Should Global.asa be in the WWWRoot folder (currently located) or the Websites folder (where index.asp located)
Does IIS need to be configured to allow .asa files? I noticed in Request Filtering the .asa is False for allowed.
Is the code correct? I even made a dummy asp page to see if just displaying the counter will work but it doesn't either.
Confirmed ASP pages
Does the ASA code look correct?
I have looked via google search and around here, nothing could give me the help that I need. I am hoping someone here could provide some direction. Greatly appreciate it.
Related
I have two websites on an IIS 7.5 box. I don't recall doing anything with the config on Site #1 that would make it special relative to #2, but I can't figure out a behavior in #2 that isn't there in #1.
With links in the site, #1 works "as expected", however #2 - unless I specific the sub folder path, reverts back to the site root. For example, in sub directories of site #1, I can just link to another page within that same directory like this:
go to other page
However, on site #2 I'm having to use the full path on any links in a sub directory or else they go back to the root level.
Structure:
root/sub/anothersub/
go to other page
This (to me anyway) should go to www.site2.com/sub/anothersub/otherpage.cfm but it's instead going to www.site2.com/otherpage.cfm.
I can get it to work if I change my links to either be full domain + path or path relative to root, but I'm curious what I could have changed so that site 2 isn't acting like site 1.
<a href="/sub/anothersub/otherpage.cfm">
or
<a href="http://www.site2.com/sub/anothersub/otherpage.cfm">
Both sites have static IPs and SSL. SSL seems makes no difference (http vs. https, etc.).
Sounds like you're outputting a <base> tag in your pages, e.g.
<base href="http://www.site2.com/">
Find where that's happening, remove it, problem solved.
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 try to access the file directly in the browser at 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?
Update with info from first answer:
We are not currently using Windows Authentication, and I verified that the application pool user account has file-system permissions. I also verified that the application can add/delete/modify files using the cmssitemanager > administration > system > files > "test files" utility which resulted in OK status for creating/deleting/modifying folders and files.
I do have Check files permission checked in cmssitemanager > settings > system > files > security. Unchecking this option does not change the behavior, including after restarting both the application and the windows services.
The site is valid and has the correct license however there was NOT a domain alias defined. I added one however this did not change the behavior.
We have not made any changes to the web.config save for connection string information. If you are referring to this documentation on CMSUseTrailingSlashOnlyForExtensionLess in the web.config, this was not previously in there however adding it did not change anything. To that end, I wasn't seeing the site trying to redirect to domain.com/CMSScripts/Custom/FOO/BAR.js/ so I truly think it's tied to some kind of security ACL that is out of order.
Here is the solution provided by user FroggEye on the Kentico DevNet forum thread on this same issue:
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:
give you a standard place to call resources from (you can get stylesheets here as well)
allow you to use the build-in minimization functions.
Charles,
This is a strange behavior, it does not normally do that.
Do you have any windows auth going on ? where you possibly removed anonymous access (in IIS) to directories in the website folder ?
Do you have Check Files permissions turned on as a Kentico Site setting? (even though I'm fairly sure that won't affect requests to the JavaScript files in JS module)
Is it a valid site (enabled and running in CMSSiteManager) and domain name with a correct license and alias ?
Any custom modifications to web.config file that possibly changed httpHandlers or modules ? And are you running the correct extensionless URL settings in web.config ?
I'm having quite a hard time figuring out this problem and I need your help. Here's the scenario:
I have a sharepoint 2010 web application on my port 80. This has 2 site collections, the root, and the /sites/official. My problem is: The root site is empty, but in the future it will be my something (I don't know what yet), but my other site collection is ready to go and I already have an Internet address for it.
What I want to do is configure everything in way that I can type http://contoso.com and get as response my sub-site (yes, its a kind of redirect)...
how can I do it? What and where should I configure it?
add content editor webpart on your root site collection and put this javascript in that webpart
<script type="text/javascript">
window.location = "http://contoso.com/sites/official"
</script>
Open IIS manager
Right click on your SharePoint website -> Properties
Go to tab Home Directory
Choose A redirection to a URL
fill the URL for redirection. for example: http://contoso.com/sites/official
Notes:
Make sure to check A Directory below URL entered to avoid redirect loop
Link to another thread might interest the reader - immediate redirect page in sharepoint
Screenshot:
Add alternate access mapping for the sub-site collection from the central administration.
Central Administration > Application Management > Web Applications > Configure alternate access mappings
Today I moved my website to a new hosting company (Verio). I've done this lots of times before, and I know that your website should go inside the "htdocs" folder.
Now usually when I use FileZilla, I can do a "Right Click" on a filename to get the URL of that file. This is the result of my root default file: ftp://test#test.com/www/htdocs/Research/index.php
However, on the web, the true URL of my default file is: www.test.com/Research/index.php
My index.php file is in the website root folder. Does anyone know why FileZilla would include the server folders "www/htdocs" as part of the URL? These folders should not normally be visible to the user.
OR, is this look correct?
That ftp url is correct. Your FTP account has access to the two folders (www/htdocs/) before the document root, as most hosting providers provide.
You are also correct to assume that http access is limited to the document root. (Meaning they cannot see www/htdocs/)
I turned on directory browsing (in IIS) for my sharepoint site, then turned it off again and now every time I try to access the site through a web browser I get 404 error, page cannot be found.
I know it's something to do with authentication but don't know where to start looking/fixing ?
Can you give a bit more background? Do you get 404's for all pages? Can you hit layouts pages? E.G:
http://YOURSITE/_layouts/settings.aspx
404's in SharePoint shouldn't be taken at face value. Check your ULS logs in:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS
We ran into a smiliar issue yesterday
More of a work around this:
Rather than try to figure out what permissions to set/reset, just delete the web application, specifying Yes to 'Delete IIS Web' sites and No to 'Delete content databases'.
This will keep the content database (with all your content you can't currently access).
Then create a new web application with the same name and host header and enter the existing content database name.
This should then recreate the IIS web app with correct permissions and connect to the existing content database.