Tag Archive for 'dev'

Squid as a captive portal… part 2

This is long overdue, but here it is anyway. The source codes I used to set up Squid as a captive portal. The bundle also includes the squid config file, the redirector script, and the authentication pages.

Requirements:

In my code, memcached is configured to be running on localhost on port 28888. Continue reading ‘Squid as a captive portal… part 2′

Attached Files:

ASP.NET Ajax, UpdatePanels and ClientScriptBlocks

For the project I am currently doing, I’m helping in developing a web application. The application itself is built on ASP.NET Ajax and thus uses UpdatePanels. One of the advantages of an UpdatePanel is that you can use the ScriptManager to execute Javascript on the client side. Today, a coworker attended me to the fact that the ScriptManager.RegisterClientScriptBlock was not working from his code behind. The code was built as a user control (.ascx), containing an UpdatePanel from which he executed his code. The control itself was loaded dynamically onto the page. The code simply did not execute, and no errors or exceptions were thrown either.

After some searching (Google, Bing, you choose), the solution turned out to be a simple one: he called the RegisterClientScriptBlock-method specifying the UpdatePanel as control to register on, which is IntelliSense’s default suggestion. After reading through MSDN, I found out that an overloaded method is available which accepts a page.

What didn’t work:
ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, typeof(UpdatePanel) Guid.NewGuid().ToString(), myScript, true);

What worked:
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(UpdatePanel) Guid.NewGuid().ToString(), myScript, true);

Using Squid to build a captive portal, for free!

The other day I was a bit bored so I wanted to try something new. I wanted to build a proxy server which required me to authenticate, but I was not satisfied with the basic HTTP authentication options Squid gave me. I wanted a nice looking webpage, with a form. I also wanted something which would allow “visitor self service”, like a “I forgot my password”-page, or a page where a user could pay and sign up.

image

This is the page I get when typing www.google.com in the address bar of my browser. Only after authenticating,  I get granted access to the internet. It isn’t just web filtering, every application that requires internet access will be denied until the authentication process has been completed.

What I was looking for, is called a Captive portal. According to Wikipedia:

Continue reading ‘Using Squid to build a captive portal, for free!’