Can any web analytics tool track page hits for included files - asp-classic

I am trying to track hits to classic asp pages which are used as include files within other asp pages. I am using LogLog as my web analytic tool since I wanted something simple and which runs behind the firewall. What I observed was that LogLog does not track the included files. It will only track the main asp page where I have all the included files. (Note: I have added script to all my .asp files) We want this info so that we can get rid of all unused asp pages in our website which have been lying around for years without anyone using them.

If you want to get rid of unused pages you could try this solution:
add to every asp the following code:
application.lock
aspname = "ASPTRACKER-" + "a.asp" ' Or "b.asp" etc...
if (clng(application(aspname)) = 0) then
application(aspname) = 1
else
application(aspname) = application(aspname) + 1
endif
application.unlock
in your global.asa make sure that the application on end event writes all these application values (starting with ASPTRACKER-) to file....
voila the usage counter of each file
code not tested so there may be a typo...

Using Google Analytics, you track exactly what you want, including specific events or ajax loadings.
You decide when you want to add a hit to the category of your choice, so you can easily add a hit when you load an included page.

Related

Change SharePoint site name using a Feature

I am running into a problem when creating a SharePoint 2010 Feature. What I am trying to do is:
Check to see if the site name is the same as the site title.
If it isn't, change the name (and therefore the URL) to match the title.
My code is as follows:
Private Sub ChangeSiteNameToMatchTitle()
_web = SPContext.Current.Web
If _web.Name <> _web.Title Then
_web.Name = _web.Title
_web.Update()
End If
_web.Dispose()
End Sub
This successfully changes the name so that it's identical to the site title, but it causes the Feature to crash at the end of it's activation cycle due to the fact that the site name (and therefore the URL) has changed.
The Feature appears to be trying to reload the ManageFeature.aspx page on the site that activated it, but since the URL has changed it cannot find the page any more.
Does anyone know of a workaround for this, or even if it's possible?
Many thanks!
I would make the Feature hidden and activate it outside of the UI using PowerShell.
Also, per best practice rule SPDisposeCheckID_220, you should not dispose SPContext.Current.Web:
SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite and SPWeb objects returned by SPContext.Site, SPContext.Current.Site, SPContext.Web, and SPContext.Current.Web.

Ask the user for number of file to upload -ASPX

I'm trying to build a website (I learning this whole subject now), and maybe the anwser is very simple.
I am devaloping in ASPX/C#, and I want that in form, there is a select field (<select>)
with option of number of files to upload, the max files to upload is 4.
I want that after I select the number of files, there will be some up;oad fields (in the number that I already chose).
My question is how can I do that? (maybe with javascript of AJAX ? I have no idea how)
Wish for help, Thanks.
I am not sure if this is what you are looking for, but give it a try
Try this:
http://jsfiddle.net/2bZwD/
`$('#select1').change(function(){
var count = $(this).val();
var uploadcount = 0;
$('.upload').each(function(){
if (count > uploadcount)
{
$(this).show('slow');
uploadcount++;
}
else
{
$(this).hide('slow');
}
});
});`
There will be two approach
1) Javascript : Using javascript you can read the max file number and add the Upload html tag on the document . As you are using ASPX , it will not work because when the form was build and viewstate was genetated these fields were not the part. If you will use ASP.NET MVC it will work and you easily using the jquery
2) If you want to use the ASP.NET webform you have to do the AutoPostback equals to true for the dropdown list and then read the value on the Selected Index change event on the server and file upload control on the server side. It has a drawback that it will require full post back. You can use the Updatepanel to do the partial post back and get the file controls in the page.

Lua socket: why doesn't socket.http.request download entire html code of a page?

I want to download to a Lua string the entire html code of this web page. The problem is that the saved code skips some lines that are visible on Google Chrome when I use Inspect Elements command (right click on webpage, last option).
I need that lines because I want to use the informations written there, to be precise I want to catch the card prices.
The code used is simply:
-- loads the HTTP module and any libraries it requires
local http = require("socket.http")
-- Lua socket --
b, c, h = http.request("http://magiccards.info/roe/en/4.html")
print(b)
How can I solve it?
Probably some of the elements on the page are created after the main document loads, either by Javascript DOM operations, or AJAX queries which fill up the missing parts. You could look if these scripts are indeed downloaded and then run them locally using some embedded engine like V8.

Scraping ASP.net website: Need to Page through a Gridview using Python Mechanize

I'm trying to scrape an asp.net page where I need to page through the items a list of items that are in a gridview control. I've never used asp.net but have been searching the Net for pointers but now I've hit a brick wall. The page links are of the form:
javascript:__doPostBack('ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems','Page$2')
I'm currently trying to get this working using Mechanize in Python. I initially tried the following, assuming that the VIEWSTATE variables would be handled by mechanize.
br.form.set_all_readonly(False)
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
Using a network monitor(Fiddler2), I noticed that two more variables were populated so I added these in too:
br.select_form(nr=0)
br.form.new_control('hidden','ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1',attrs = dict(name='ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'))
br.form.new_control('hidden','hiddenInputToUpdateATBuffer_CommonToolkitScripts',attrs = dict(name='hiddenInputToUpdateATBuffer_CommonToolkitScripts'))
br.form.new_control('hidden','__ASYNCPOST',attrs = dict(name='__ASYNCPOST'))
br.form.set_all_readonly(False)
br['hiddenInputToUpdateATBuffer_CommonToolkitScripts'] = '1'
br['__ASYNCPOST'] = 'TRUE'
br['ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$SearchResultsUpdatePanel|ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
With both of these the html I get back is still for page 1 only.
I think there may be a couple of potential issues:
I'm not sure I'm doing the submit right. There are multiple submit buttons on the page so the one I'm searching for is the "search" button, which is what I previously used to get to the first page. I could see that being why the first page is displayed. If I use br.submit() without a name then it uses another submit control that takes you somewhere else.
When you click a page number in a browser, the gridview control updates without a page reload. As I'm not running Javascript, maybe I can't get that but I would at least expect to be able to get back the data from the POST and parse that.
Any help would be much appreciated!
Managed to to it by building an xmlhttprequest per the answer here:
Using Python and Mechanize to submit form data and authenticate

Microsoft Communicator Presence Indicators (Status Indicator) in a custom asp.net page

All, I am looking for a way to add an OCS presence icon the same that you would see in sharepoint, but i am looking to add it in a custom asp.net web site.
Please assist!
Bill.
You can use the "Presence in a Web App" sample from Microsoft.
http://www.microsoft.com/downloads/details.aspx?FamilyId=AEBFA4E2-B30E-43A6-BF34-6403465BC9A9&displaylang=en
Take a look at the following sample from Microsoft (Not the AJAX one!):
http://www.microsoft.com/downloads/details.aspx?familyid=63388959-7320-4ffd-9167-655365d94b67&displaylang=en
To understand how to get a presence indicator that is visible when you hover over a span text look at the C:\Program Files\Microsoft Office Communications Server 2007\Developer Samples\Presence in Web Applications using Communicator Automation API\Samples\Demo\LitwareInc\resources\team\Example.html file after installing the sample.
If you want to add a presence indicator that always shows up you need to create a new ID for each img tag you add to your page.
You can do this in codebehind by incrementing a counter variable by 1 each time:
<img id=img" + presenceCounter + " src=presence_img/presence_16-unknown.png onload=PresenceControl(\"" + Mail_Address + "\")></span>`

Resources