Webcasts, security, and failed demos...

Onion Blog

Syndication

This blog entry is primarily for the 1200+ attendees of the webcast on configuration and deployment in ASP.NET 2.0 that I gave last Friday (Mar. 10, 2006). There were a couple of demos during the presentation that failed and I wanted to make sure everyone was clear on why they failed and what the problems were.
 
Now normally in a presentation when a demo fails, I use it as a teaching opportunity and diagnose the problem as a group - in fact, failed demos are sometimes the high point of a presentation (assuming of course you succeed in diagnosing the problem :) since developers encounter problems like this every day, and it helps to watch how someone else approaches finding a solution. The webcast format, however, makes this style of instruction prohibitively difficult. It is possible for attendees to pose questions and potentially help diagnose the problem, but with more than 1200 attendees it is just too cumbersome for me to look through the queue of questions as I try and interactively debug. The fixed time constraint is also an issue, since debugging can take an unknown amount of time and the webcast is limited to 60min or so.
 
Because of these limitations, I normally run through all my demos for a Webcast very carefully to make sure they are all working properly. This session was no exception, the only problem was I ran through them on a different machine from the one I ended up presenting on, so there were some configuration differences that caused the problems.
 
Anyway, enough excuses - let me describe what went wrong. In the first demo, I forced authentication by adding an authorization element to my web.config file disallowing anonymous users:
 
<authorization>
<deny users="?"/>
</authorization>
 
I didn't change the default authentication mode, which means it was left to "Windows" authentication (also called integrated windows authentication) which requests that the browser respond to a challenge-response using the credentials of the client as he/she is logged in (potentially prompting for alternate credentials if the first set fail). Once I tried running a page in this site, I received an access denied failure even though I was logged in as a valid user on the same machine as the server. The problem, it turned out, was that I had not enabled Integrated authentication on the virtual directory in IIS, which ASP.NET relies on to actually implement its "Windows" authentication mode (it ends up requesting that IIS perform the authentication). So once I enabled it using the following setting in IIS, it worked without a hitch:
 
 
The next failed demo was when I switched to using the membership features of ASP.NET 2.0 and forms authentication by adding an authentication element to the web.config file and setting up a couple of users in the default aspnetdb.mdf database.
 
<authentication mode="Forms" />
 
This time it refused to authenticate me no matter how many times I tried typing in the username/password (even after carefully resetting the password on the chance that I had typed it in wrong as I created the users). This time, the issue was that my browser had cookies disabled, so by changing my default privacy (cookie management) from Medium to Low, it began accepting cookies again and everything works fine.
 
 
This last problem is actually a more general problem that sites face all the time - if clients don't have cookies enabled, how to you grant them an authentication token that accompanies each request they make after passing your authentication test? ASP.NET 2.0 actually introduces a nice solution to this by automatically detecting whether a client has cookies enabled, and if he/she does not, resorting to URL mangling to store the authentication token instead. Here's the configuration setting you can add to enable this feature (which would also have fixed my problem!):
 
<authentication mode="Forms">
  <forms cookieless="AutoDetect" />
</authentication>
 
Anyway, that was the extent of the failed demos for that session - I hope this helps any of you that attended and were wondering what had gone wrong :) From now on, my new policy for webcast demo prep is that it be on the exact machine I plan to run the session from - no exceptions!
 

Posted Mar 13 2006, 07:50 AM by fritz-onion
Filed under:

Comments

MP wrote re: Webcasts, security, and failed demos...
on 03-13-2006 3:06 PM
Thanks For the explaination - its helpful
Christopher Steen wrote Link Listing - March 13, 2006
on 03-13-2006 6:13 PM
All in all we’re just another brick in the
wall… [Via: rocky@lhotka.net (Rockford
Lhotka) ]
ASP.NET...
Matt wrote re: Webcasts, security, and failed demos...
on 03-18-2006 4:05 PM
Can ASP.NET 2.0 autodetect cookieless clients in its support for sessions? I know in 1.1 there was a cookieless mode that would embed the session id in the URL, but there didn't seem to be any way to use cookies when they were available and still have a fallback when they were not. It's something I miss from PHP.
Fritz Onion wrote re: Webcasts, security, and failed demos...
on 03-18-2006 4:09 PM
Yes, you can set <session cookieless="AutoDetect" /> in your config file as well, for the same effect.
Matt wrote re: Webcasts, security, and failed demos...
on 03-18-2006 4:31 PM
Awesome! Thank you.
Z. AICHOUR wrote re: Webcasts, security, and failed demos...
on 03-30-2006 5:31 AM
Very Interesting webcast, I've really appreciated, Thank You.
Mike Hardeman wrote re: Webcasts, security, and failed demos...
on 03-30-2006 11:47 AM
I think, in this case, the problems encountered in the demo helped raise my awareness of the "session cookieless" feature, which will be very helpful. I might not have ever known about it if my curiosity had not been piqued by the original flub in the demo.

Let me take this opportunity to thank you for all the webcasts. I took the standard 3-day course back in October, but the luxury of viewing the webcasts and re-viewing them reallly helps the retention process.
Dave wrote re: Webcasts, security, and failed demos...
on 04-07-2006 4:43 PM
Fritz, thanks for the enormously informative webcasts. I'm new to pretty much ASP.NET altogther but your tutorials have allowed me to get a basic web application up and running in a very small amount of time. I'm actually thankful for the failures during this demo and it taught me some additional things I would not have know.

Thanks
Anselmo Casanova wrote re: Webcasts, security, and failed demos...
on 05-02-2006 5:10 AM
Fritz, I am just taking the ASP.NET 2.0 webcast from microsoft, and I wonder if I can have the code yo mention in the webcast.

Thank you,

Regards,

Anselmo
David Rogers wrote re: Webcasts, security, and failed demos...
on 09-09-2006 10:38 AM
The very first problem you encountered was due to the fact that when a new virtual directory is created, Default.aspx is not one of the default documents that IIS recognizes. It was really frustrating watching the webcast today and not being able to go back in time and tell you that! :-)

Nice webcasts!

David
David Rogers wrote re: Webcasts, security, and failed demos...
on 09-09-2006 3:42 PM
OK, the rest of the explanation didn't get things working on my machine... I think I have found the problem:

http://msdn2.microsoft.com/en-us/library/ms178375.aspx

"SQL Server Express Edition
When a process attaches to a SQL Server Express Edition database (.mdf file), the process must have administrative permissions. In general, this makes SQL Server Express Edition databases impractical for production Web sites because the ASP.NET process does not (and should not) run with administrative privileges. "

So, I think you could only have gotten the demo to work using the setup you had if you had added impersonation and supplied an account that had admin privileges. At least that is what it took on my machine.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?