|
| Latest
Web News |
Optus plans $800m 3G network AUSTRALIA'S second largest telco Optus plans to spend up to $800 million to build a new third generation (3G) mobile network which it says will reach 96 per cent of the population. Optus chief executive Paul O'Sullivan said the telco would build a new communications network with...
Australians in virtual world stampede Telstra and the Australian Broadcasting Corporation will announce shortly that they have established, separately, a presence in the cult virtual world of Second Life. They will join a growing throng of international companies - including Dell, Toyota, Adidas, IBM, and Intel - who...
Telstra 3G 'outperforms' Optus network TELSTRA says its third-generation (3G) mobile network is faster than that of rival Optus, with wider reach and better content. "Consumers are flocking to Telstra's (tls.ASX:Quote,News) next G (next generation) network because it already has much faster speeds, much longer transmission range, much wider reach into the...
Telstra seeks to extend payphones' lifespan Mobile phones may be ringing a slow death knell for the payphone but Telstra is hoping a marriage between two ageing technologies can extend its lease on life. The telco and ANZ have announced a partnership that could help financially prop up some of the nation's less...
Microsoft launches Vista in Australia Computer giant Microsoft has opened the curtains on the latest version of its Windows operating system to a significantly more connected generation of Australian personal computer users. But while the global consumer launch of Windows Vista was met with the usual...
Hopes IT centre will attract world's best researchers Renovations will soon begin at the CSIRO in Tasmania to make way for a new $29 million Information and Communication Technology (ICT) research centre. Twelve scientists have already started working at the site. Scientists and researchers working at the new ICT...
Western Australia hires broadband chief The Western Australia state government has hired a telcommunications and IT services group that will appoint a key executive to oversee the development of its planned AU$1 billion state-wide network (SBN). The state has awarded the executive project manager to Consultel, according to the state's Department of Industry...
|
 | |
|
01.30.07
ASP.NET: Access Client Info Server-side
By
Mads Kristensen
I was playing around with HTTP request headers and for some reason started thinking about how limited information they provide about the requesting browser.
All they really provide is the user agent string which provide very little information about the visitors platform, and that's about it. If they also provided screen resolution and available browser window real estate, it would start being useful for other scenarios than we are used to.
Then I started thinking about a way to provide ASP.NET web applications with data retrieved from the browser without interfering with the browsing experience. I found that the only way to get client information from JavaScript transferred to server-side variables is to do redirection, but that is not acceptable. Well, at least I thought. It is actually possible to do redirections without the browser registers it in its history so the back button would act as nothing happened.
This means that it should be possible to retrieve the information in a way that is totally transparent to the visitor. In other words, the website appear to act 100% as usual. If you don't believe me, read on and I'll tell you how it's done.
If it is using JavaScript to gather the information it also means that all information you can possibly retrieve from JavaScript can be transferred to the server. In this version I've implemented the properties you can see in the image above. It is very easy to add more. The code comments tells how.
How it works
To do the trick we need an HttpModule and HttpHandler. The module's job is to expose the client-side variables to the ASP.NET code while the HttpHandler fills them with data from the browser.
Cost Effective Website and Network Monitoring IPCheck Server Monitor - Free Download |
|
At every request to an .aspx page the module checks if the variables have been set for the requesting visitor. If the page is the first one the visitor hits, the module write a small JavaScript to the tag that collects the information we need and does a silent redirection to the HttpHandler. The handler registers the information sent from the JavaScript and stores it in session variables. Afterwards it redirects back to the original requested page without the visitor noticing any redirection has taken place.
Before you think it sounds too complex, let me assure you that it is very simple. Not only is it simple, it is also plug 'n play so you can easily implement it into any existing web application - no code required. I've tested it in IE 7, Firefox 2 and Opera 9 all on Windows and it works perfectly. This might be the coolest thing I've ever developed.
Implementation
That is all there is needed to gain access to the properties of the ClientStats module.
Download
ClientStats.zip (1,85 KB)
Comments
About
the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.
http://www.madskristensen.dk/
|
|