<2017 March>
SunMonTueWedThuFriSat
2627281234
567891011
12131415161718
19202122232425
2627282930311
2345678

On this page...

FOSDEM Video Recordings
Office Business Applications (OBA)
Security for Applications in Windows Vista Forum
MVP Visual Developer - ASP/ASP.NET Again 2007
Advanced Code Access Security
A Chronology of Data Breaches
MVP 2006
Community Wintercamp 2006
Google PageRank as a .NET Assembly
Community Server v1.2 will support setting the SMTP port number
Telligent acquires Dozing Dogs CMS
Built to scale
Warning: Low-Flying Golf Balls
Slides, Demos, Links for Yesterday's UG Talk
SQLUGA: SQL Server 2005 - Database Mirroring
Community-driven Security Conference in Vienna, Austria
Writing a Subversion-backed VirtualPathProvider for ASP.NET 2.0
NCC 2005 A
Adding auditing capabilities to SqlMembershipProvider
Community Bootcamp 2005 Fully Booked
http://beta.asp.net Launch
Regional MVP Get-Together, Vienna
Community Day: Indigo
.NET DA: Securing Service Oriented Architecture (SOA) with Microsoft's WSE 2.0
BLfH Shop
Community Wintercamp 2005 is over
One Week...
Upcoming: our next hole on the code fairway
Next Monday: MSDN Webcast by His Chrisness
MVP Award Awarded Again
SSUGA "Summer" Academy: ADO.NET, 16th - 18th November
Connect Event, Barcelona, 20. - 21. October
Search

Links

Member of...


ASP Insiders

MVP Visual Developer ASP/ASP.NET

Enter CodeZone

Blog Categories

Microsoft

Blogroll

Deutsche Resourcen

Management

Sign In
 

#  Wednesday, 28 February 2007

The video recordings for the main tracks of FOSDEM 2007 are online now. Of interest for .NET developers might be Miguel's session on "Turbocharging Linux with Mono".

Categories: .NET | Community
Wednesday, 28 February 2007 09:20:15 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Tuesday, 20 February 2007

Yesterday, Peter Koen held a talk at the .NET UG Vienna about Office Business Applications (OBA). I had ignored this topic up until now, but it definitely is worth checking out. Get started with Office Business Applications: What is it, and how can I get started? and then head over to the Office Business Applications Developer Portal. (Also have a look at the topics in Architecture Journal #10)

Tuesday, 20 February 2007 11:09:37 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Thursday, 25 January 2007

Got a developer question on how Windows Vista security affects your application? Then the MSDN Forum Security for Applications in Windows Vista is the right place to go.

Categories: Community | Security | Vista
Thursday, 25 January 2007 10:38:07 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 03 January 2007

I have been re-awarded MVP for Visual Developer ASP/ASP.NET.

Categories: ASP.NET | Community | this
Wednesday, 03 January 2007 10:37:47 (W. Europe Standard Time, UTC+01:00)  #    Comments [2]

 



#  Monday, 30 October 2006

Last Tuesday, I held the talk "Advanced Code Access Security" at UG Styria in Graz. This talk was originally part of the MSDN Security Briefings held in Austria earlier this year, for which MS Austria had asked MVPs to help create and deliver security content. Advanced CAS seemed an interesting enough developer topic to re-run at user groups, and Mario (the author of this session) has allowed me to publish the slide deck and demos for the general public.

AdvancedCodeAccessSecurity.pdf (4542 KB)

AdvancedCAS.zip (599.6 KB)

Please note that I have published only demos four (setting CAS via setup) and six (using CAS in addin application) - those are the "completed" versions of the demos.

Categories: .NET | 2 Ohhhh | Community | Cool Download | Security | this
Monday, 30 October 2006 09:10:54 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 12 April 2006

During the MVP Open Day in Munich last week (Friday & Saturday), we had a presentation by Talhah Mir (ACE Team, Threat Modeling blogs) on threat modeling - which (I hope) everyone is familiar by now. During the talk, he pointed us to an interesting resource: A Chronology of Data Breaches from the Privacy Rights Clearinghouse. Quite an interesting list of incidents, which gives you an idea of the ratio of actual hacking vs dishonest insider, as well as other types of security breaches.

Categories: Community | Security
Wednesday, 12 April 2006 10:20:38 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Monday, 09 January 2006

Today, I got my MVP award package, which kind of makes it fully official. No surprise with my area of expertise: Visual Developer ASP / ASP.NET.

Categories: ASP.NET | Community | this
Monday, 09 January 2006 18:20:44 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 04 January 2006

Only a little more than two weeks to go until our yearly Community Wintercamp - "our" as in German .NET mailing list community. The agenda [German] has been posted quite some time ago, and this year it's going to be great because we already have tons of snow (literally). If you are a .NET aficionado living nearby (I like to define "nearby" as Switzerland, Germany or Austria) you are welcome to join a band of geeks in the snow! To whet your appetite, take a look at the photos and accounts of the past events.

Categories: Community | this
Wednesday, 04 January 2006 12:41:23 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Monday, 05 December 2005

Today, a member of our German .NET community asked if it is possible to programmatically query the Google page rank. He had seen it done in PHP (here on the Google Community site), but didn't have time / PHP skills to translate it. All I found on a rather shallow search was PullRank, which I'd describe as non-fit for server use.

So I decided to set out to convert the PHP sample. Being PHP-challenged myself, I decided to give the PHP to ASP.NET Migration Assistant a shot. Whoha! That converted code is the most convoluted contraption to be called code I have seen - ever. I tried to get it to run, but failed because the conversion left me with some loose ends.

Instead of giving in, I contacted Christian Wenz to lend me a hand because he has some PHP experience. He thankfully hosted an "annotated" version of the PHP script so I could look at the output of various stages to test my solution with known-good values. That was most helpful.

Instead of doing a Web site demo application with everything intertwined, I split up the project into two - GPRDotNet being a DLL assembly project you can reference in any type of .NET application (Windows Forms, Web Forms, you name it), as well as a simple Web frontend to demo the usage: DemoSite.

Querying the page rank is really simple - the following snippet is the code from the "Check PageRank" button event handler:

protected void doCheckPageRank_Click(object sender, EventArgs e)
{
  GooglePageRank pr = new GooglePageRank();

  string url = webSiteUrl.Text;

  try
  {
    string rank = pr.GetRank(url);
    thePageRank.Text = rank;
  }
  catch (Exception ex)
  {
    // this is rather chatty (telling the end user everything *IS* a bad idea)
    thePageRank.Text = "Requesting the page rank failed. Reason: " + ex.ToString();
  }
}

I want to emphasize that the code for the GooglePageRank class is a rather quick & dirty port of the PHP code and that it does not contain the necessary error handling you would expect for a server-side library. After all, it is just a proof of concept for our community.

Finally, here is the source code: PageRank.zip (26.89 KB)

If you find errors, please leave a blog comment so others know about improvements. Thanks!

Categories: .NET | 2 Ohhhh | ASP.NET | C# | Community | this | Use the source Luke
Monday, 05 December 2005 19:03:00 (W. Europe Standard Time, UTC+01:00)  #    Comments [1]

 



#  Saturday, 15 October 2005

Now that's what I call a quick response to my request. Thanks! Community Server rocks.

Categories: Community | this
Saturday, 15 October 2005 17:12:05 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Monday, 03 October 2005

Rob Howard blogs about this acquisition. Cool things coming to Community Server!

Categories: ASP.NET | Community
Monday, 03 October 2005 19:51:06 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 

At the MVP Summit, the EMEA / LATAM ASP.NET MVPs were partnering to prepare feedback for the team (any more information and I have to shoot you, or shoot your lawyer if you prefer). We were having a jolly good time (we all agreed to spend money on beer and... but that's another story). At that point I suggested that we (book authors, bloggers, article authors, et al) should slap a mandatory warning on our sample code / application: "Not built to scale."

However, in the German community we have an application built to scale: CodeFairway.NET. I wrote an overview article, now Alex followed up with an in-depth look at the features, architecture and techniques of CFW. Read Code Behind: CodeFairway.NET.

Categories: ASP.NET | Community | this | Web Services
Monday, 03 October 2005 17:24:41 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Sunday, 02 October 2005

The MVP Summit 2005 is over, and with the exception of Transportationgate, it was a great event - even though I had attended PDC05, and worked with Whidbey for years now. I don't primarily come for the news, but talking to other MVPs as well as product group members.

On the community side of things, Alex and I put the finishing touches on the localization feature of CodeFairway.NET, which now includes the ability to play a tournament in a specific timezone.

You don't know what CodeFairway.NET means? Let me introduce .NET Golf to you:

Now, that is intentionally a graphic, to show that sites made by programmers for programmers need not be ugly but can be quite appealing. Here goes the text for easier reading:

"What is .NET Golf?" How did the union of a programming technology and a lawn sport come about? Well, the idea is simple and fascinating: in 'classical golf' the winner is the player using the least number of strokes to hole out. We transferred this concept to programming: whoever needs the fewest number of characters to solve a given programming problem wins the tournament. Speed and elegance of the solution are not criteria.

Each tournament extends over a given time span, after the end of the tournament we hold 'post mortems', i.e. the participants explain their solutions (so that there may be a great wailing and gnashing of teeth behooving the creative abuse of the technology).

.NET Golf is the successor of ASP Golf which was quite popular among German language developers for a long time (the actual ancestor of code golf is Perl Golf). As many golfers switched over to .NET, we decided to migrate this waste of time ^H^H^H^H^H^H^H^H^H^H^H^H^Hmost excellent use of technology to .NET so that the envelope of programming could continually be pushed further.

Sounds interesting, doesn't it? That's what we thought and that's why we ran a tournament at the MVP summit (all English, you can browse it to learn more) to introduce other MVPs to .NET Golf - and whet their appetite to be the host for .NET Golf in their community. If you didn't get a chance to talk to me at the summit, here's what we (German community members, so that there are no misunderstandings) offer: we host the site for you on CodeFairway.NET, and we provide you with the automated test system we have created so that there is little to no overhead for you. Your job: translate the site into your community's native language, and come up with challenges (we can help get you started). My MSN account to get in touch with me: christoph dot wille at alphasierrapapa dot com (also my email alias if you prefer emailing me upfront).

Funny enough at the MVP summit, for the very first time in history of our tournaments, the VB.NET golfers won the tournament hands down. That might have changed if only Karsten and the others would have paid more attention to the sessions ;-)

The leaderboard for the first three looked like this (and yes, the Show link does show the source of the submission - check it out):


It took them quite a while to get on the green, but as with every other tournament I heard something like this: "I only wanted to play till 11:30PM, but at 1:30AM I finally coaxed me to go to bed". Addictive. Even for a simple challenge such as the one played at the MVP Summit:

How can you tell whether three lines of a given length make up a triangle? Some cases are obivious - equilateral triangles, isosceles triangles and triangles governed by the Pythagorean theorem. General triangles are a different matter though. You are now challenged to decide whether a given set of three integers represents the sides of a triangle and indicate this by passing back true, otherwise passing back false to the test application. Please note that "flat" triangles (triangles which have the shorter sides add up to the length of the longer side) do not count as triangles.

The class name for this challenge is Tee, the method name Off. The values for the three sides are passed as a string (never empty, always three values contained) to the Off method, the values are separated by a single space (eg "300 400 5000" which obviously is not a triangle). The values are non-negative integers.

So if you are interested in being the host for your community, get in touch with me. .NET Golf is very popular: currently, Microsoft Austria is using our German codefairway to play a MSDN Connection tournament. Mario just announced it (English).

Categories: .NET | Community | this
Sunday, 02 October 2005 16:21:26 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Friday, 09 September 2005

Although the files for this TechTalk repeat are identical to the TechTalk downloads, I noticed that the download location has been moved. For your convenience, here are the direct download links to the three respective files:

Friday, 09 September 2005 07:42:23 (W. Europe Daylight Time, UTC+02:00)  #    Comments [3]

 



#  Tuesday, 06 September 2005

Yesterday, I attended Kevin Cox' talk about database mirroring in SQL Server 2005. The event was organized by the SQL Server User Group Austria in Vienna, with Peter Koen (old UG lead) inviting Kevin, and Jaser Elmorsy (new UG lead) organizing it. Session description for the records: Database mirroring is a new SQL 2005 feature for high availability. What happens if you combine mirroring with other features, like snapshot and clustering? This presentation will teach you the basics of database mirroring, then will discuss some advanced topics for common solutions.

Kevin also pointed us to the SQLCAT blog - CAT being shorthand for Microsoft SQL Server Development Customer Advisory Team. The description as well as Kevin promised that they will be posting demanding scenarios and solutions to those in that very blog.

Categories: Community | SQL Server
Tuesday, 06 September 2005 07:33:57 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Tuesday, 02 August 2005

On 12th of August, the Austrian .NET community is hosting a one-day conference on security, targeted at developers (no surprise here). The topics for NCC 2005 A include:

  • Threat Modeling
  • What's new in .NET 2.0 Security
  • What's new in SQL Server 2005 Security
  • What's new in Windows Vista Security

Quite a nice line-up I'd say. This event is supported by Microsoft Austria, so attending this event is free, except for your time, but I am sure security does warrant a day of your time! Sign up here

Tuesday, 02 August 2005 15:27:45 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Wednesday, 27 July 2005

This post is again motivated by last week's Community Bootcamp on ASP.NET 2.0, the CBC05. I presented "Under the Covers - Exploring Internals, Page Lifecycle and the Compilation Mode" from TechEd, using the samples that Simon Calvert provided me with (special thanks fly out to Simon, Ben Miller and Rich Ersek @MS for providing us with material - I know I can be a royal pain in the posterior... sometimes at least).

The talk included a demo of a database-backed virtual path provider (files don't come from the file system but a database, dynamically). Somehow we started talking about how cool it would be if you could test your Web sites without checking them out from source control in the first place - by simply writing a virtual path provider that goes to the repository on demand. I wrote that idea down.

Actually, I didn't think I'd get around to doing that. But yesterday I decided to pester one of my devs on the #develop project, namely Daniel Grunwald. He has implemented the Subversion addin for our 2.0 version, so he had experience with NSvn, the managed API for talking to Subversion. I sent a stripped down version of the vpath provider to him, and asked him to replace database code with NSvn code where appropriate.

It didn't take long, and I had a command-line verified version back, and all I had to do was make sure that it works with ASP.NET 2.0. There were a few problems I ran into (like Subversion is case-sensitive and I didn't want that for the Web scenario). Some of the issues arose simply because client and Web developers have different backgrounds. Talk about path separators. Or directories where you have to drop assemblies.

Now, let's stop talking, let's take a look at the provider in action:

SvnVPathProvider.wmv (3.76 MB)

Want to get your hands on that DemoSiteSvn directory with the current rendition of the SubversionVirtualPathProvider? No problem, just a couple of notes up front on what you should be aware of:

  • Only file names are currently treated specially for casing. Ie directories still do react in a case sensitive way.
  • The file name cracking code needs to be reviewed. Currently, this is a quick hack.
  • appSettings need to be placed in a separate .config file. Reason is that web.config cannot be obtained via a VirtualPathProvider, and thus this file has to be checked out separately. And I don't want to get in the way of automating this by requiring entries in web.config.
  • Package it as an assembly, so only the \bin folder needs to be copied to get up and running.
  • The VirtualPathProvider requires (at the very least) anonymous access to the repository. Passing security tokens is not implemented.

With those notes out of the way, thanks fly out to the ASP.NET team for providing me with the sample of their virtual path provider in the first place. It has been a tremendous help to get this thing off the ground. And maybe in turn this sample will help others to get started:

SvnVppDemo.zip (972.37 KB)

Installation note: the two DLLs in the system32 folder need to be dropped in the respective folder of your system. Do not place them into \bin. Unless you want to get into trouble, that is.

What is left to say? Oh, the source code, of course! I thought you might be interested in reading it online instead of having to download an almost 1MB-size file first. Here it is (App_Code\SubversionVirtualPathProvider.cs):

using System;
using System.IO;
using System.Collections;
using System.Globalization;
using System.Configuration;
using System.Text;
using System.Web;
using System.Web.Util;
using System.Web.Hosting;
using System.Web.Caching;
using NSvn.Core;
using NSvn.Common;

namespace ICSharpCode.Web.Providers
{
public class SubversionVirtualPathProvider : VirtualPathProvider
{
#region class HashCodeCombiner
internal sealed class HashCodeCombiner
        {
            // Start with a seed
            private long _combinedHash = 5381;
            
            internal void AddLong(long l)
            {
                _combinedHash = ((_combinedHash << 5) + _combinedHash) ^ l;
            }
            
            internal string CombinedHashString
            {
                get
                {
                    return _combinedHash.ToString("x", CultureInfo.InvariantCulture);
                }
            }
}
#endregion

#region class SubversionVirtualFile
internal class SubversionVirtualFile : VirtualFile
    {
        string fullPath;
        DirectoryEntry entry;
            
        public SubversionVirtualFile(string virtualPath, string fullPath, DirectoryEntry entry)
                : base(virtualPath)
        {
            this.fullPath = fullPath;
            this.entry = entry;
        }
            
        public override bool IsDirectory {
            get {
                return entry.NodeKind == NodeKind.Directory;
            }
        }
            
        public override Stream concat()
        {
            Client client = new Client();
            MemoryStream ms = new MemoryStream();
            client.Cat(ms, fullPath, Revision.Head);

            // .Cat closes the stream, so we have to copy it
            MemoryStream ms2 = new MemoryStream(ms.GetBuffer());
            ms2.Position = 0;
            return ms2;
        }
}
#endregion

public static void AppInitialize()
    {
        SubversionVirtualPathProvider provider = new SubversionVirtualPathProvider();
        HostingEnvironment.RegisterVirtualPathProvider(provider);
    }
        
    string GetSvnFullpath(string virtualPath)
    {
        if (bool.Parse(ConfigurationManager.AppSettings["svnvppStripVdir"]))
        {
            // this will break root Webs, StripVdir should be the default however
            int pos = virtualPath.IndexOf('/', 1);
            virtualPath = virtualPath.Substring(pos, virtualPath.Length - pos);
        }

        return ConfigurationManager.AppSettings["svnvppRepositoryUrl"]
            + virtualPath;
        }

    string GetSvnFullpath(string virtualPath, string fileName)
    {
        return FixupSvnFullpath(GetSvnFullpath(virtualPath), fileName);
    }

    // Subversion is case sensitive, this we switch the filename here
    string FixupSvnFullpath(string svnPath, string fileName)
    {
        int pos = svnPath.LastIndexOf('/');
        string parentDirectory = svnPath.Substring(0, pos + 1);
        return parentDirectory + fileName;
    }
        
    DirectoryEntry GetEntry(string virtualPath)
    {
        Client svnClient = new Client();
        string fullPath = GetSvnFullpath(virtualPath);
        int pos = fullPath.LastIndexOf('/');
        string parentDirectory = fullPath.Substring(0, pos);
        string entryName = fullPath.Substring(pos + 1);

        try
        {
            DirectoryEntry[] entries = svnClient.List(parentDirectory, Revision.Head, false);
            foreach (DirectoryEntry entry in entries) 
            {   
                if (0 == String.Compare(entry.Path, entryName, true))
                        return entry;
            }

            return null;
        }
        catch (SvnClientException ex)
        {
            if (ex.ErrorCode == 160013) // parent directory not found
                return null;

            throw;
        }
    }
        
        public override bool FileExists(string virtualPath)
        {
            DirectoryEntry e = GetEntry(virtualPath);
            if (e != null)
                return e.NodeKind == NodeKind.File;

            return Previous.FileExists(virtualPath);
        }
        
        public override bool DirectoryExists(string virtualDir)
        {
            DirectoryEntry e = GetEntry(virtualDir);
            if (e != null)
                return e.NodeKind == NodeKind.Directory;
            return Previous.FileExists(virtualDir);
        }
        
        // Obtain the file. This will only be called if the hash that we return is
        // different than that the runtime holds on to as a cached indicator.
        public override VirtualFile GetFile(string virtualPath)
        {
            DirectoryEntry e = GetEntry(virtualPath);
            if (e != null)
                return new SubversionVirtualFile(virtualPath, GetSvnFullpath(virtualPath, e.Path), e);
            // Default to the previous implementation
            return Previous.GetFile(virtualPath);
        }
        
        /// ///////////////////////////////////////////////////////////////
        /// Return a hash value indicating a key to test this file and dependencies have not been
        /// modified
        public override string GetFileHash(string virtualPath, IEnumerable virtualPathDependencies)
        {
            HashCodeCombiner hashCodeCombiner = new HashCodeCombiner();
            
            ArrayList unrecognizedDependencies = new ArrayList();
            
            foreach (string virtualDependency in virtualPathDependencies)
            {
                DirectoryEntry e = GetEntry(virtualDependency);
                if (e != null) {
                    hashCodeCombiner.AddLong(e.Size);
                    hashCodeCombiner.AddLong(e.CreatedRevision);
                } else {
                    unrecognizedDependencies.Add(unrecognizedDependencies);
                }
            }
            
            string result = hashCodeCombiner.CombinedHashString;
            
            if (unrecognizedDependencies.Count > 0)
            {
                result += Previous.GetFileHash(virtualPath, unrecognizedDependencies);
            }
            
            return result;
        }
        
        /// ///////////////////////////////////////////////////////////////
        /// The cache dependency is a specialized object that means that the runtime
        /// can perform file monitoring and change notifications directly
        public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            // This VPP does not create CacheDependencies
            DirectoryEntry e = GetEntry(virtualPath);
            if (e != null)
                return null;
            
            return Previous.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
        }
    }
}

 

Categories: 2 Ohhhh | ASP.NET | Community | Subversion
Wednesday, 27 July 2005 08:18:56 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Tuesday, 26 July 2005
The registration for this year's .NET Community Conference in Austria went live today (register here, it's free). The thread of this years rendition is security: threat modeling, .NET 2.0 security features, SQL Server 2005 security and more. Definitely worth your time, if you have time to spare, join us on 12th of August in Vienna!
Tuesday, 26 July 2005 15:37:13 (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]

 



#  Monday, 25 July 2005

On Friday, it was my turn as speaker at the Community Bootcamp 2005 aka CBC05. One of the topics at hand was "The Provider Model", with a focus on Membership providers. Those are the ones most likely being extended / written from scratch, and we did an exercise in that very area: Extend the SqlMembershipProvider to audit successful and failed logins similar to *nix. The solution I present today is a streamlined solution programmed by Alexander Schoeppl, one of the attendees.

Step 1: Create the table

CREATE TABLE [dbo].[myLoginAuditing](
 [username] [varchar](255) NOT NULL,
 [numberofSuccessfulLogins] [int] NOT NULL,
 [numberofFailedLogins] [int] NOT NULL,
 [lastFailedLogin] [datetime] NOT NULL,
 [lastFailedLoginIP] [varchar](15) NOT NULL)

Step 2: Create the stored procedure

create procedure myLogUserVisit(
  @username as Varchar(255),
  @success as int,
  @lastfailedLoginIP as varchar(15))
as
   IF ( EXISTS ( SELECT username
                  FROM   dbo.myLoginAuditing
                  WHERE  username = @username ) )
    BEGIN
    if (@success = 1)
    Begin
      update myLoginAuditing set
numberofSuccessfulLogins = numberofSuccessfulLogins + 1
        where username = @username
    End
    else
    begin
      update myLoginAuditing set
numberofFailedLogins = numberofFailedLogins + 1,
                    lastFailedLogin = GetDate(),
                    lastfailedLoginIP = @lastFailedLoginIP
        where username = @username
    end
  END
  ELSE
  BEGIN
    if (@success = 1)
    Begin
      insert into myLoginAuditing (username, numberofSuccessfulLogins,
numberoffailedlogins, lastfailedlogin, lastfailedloginip)
values (@username, 1, 0, '01.01.1900', '')
    End
    else
    begin
      insert into myLoginAuditing (username, numberofSuccessfulLogins,
numberoffailedlogins, lastfailedlogin, lastfailedloginip)
values (@username, 0, 1, GetDate(), @lastfailedLoginIP)
    end   
  END

Alexander did a smart thing - he looked at the various aspnet* sp's.

Step 3: Write the Membership provider

The class skeleton looks like this:

public class MyMembershipProvider : SqlMembershipProvider
{
public override bool ValidateUser(string username, string password)
{
}

public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
}

public override MembershipUser GetUser(string username, bool userIsOnline)
{
}
}

Initialize is the easy but essential part - we need the connection string name for later:

private string connectionStringName;

public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
connectionStringName = config["connectionStringName"];
base.Initialize(name, config);
}

Now we can validate the user - well, the base class does that. We only do the auditing part:

public override bool ValidateUser(string username, string password)
{
HttpContext.Current.Trace.Write("ValidateUser:entry");

bool bSuccess = base.ValidateUser(username, password);

string connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;

SqlConnection conn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("exec myLogUserVisit @username, @success, @IP", conn);

cmd.Parameters.AddWithValue("@username", username);
if (bSuccess)
  cmd.Parameters.AddWithValue("@success", 1);
else
  cmd.Parameters.AddWithValue("@success", 0);

cmd.Parameters.AddWithValue("@IP", HttpContext.Current.Request.UserHostAddress);

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

HttpContext.Current.Trace.Write("ValidateUser:exit");

return bSuccess;
}

Step 4: Set it up - web.config

  <appSettings/>
  <connectionStrings>
    <add name="MyNWind" connectionString="Data Source=cbc05vpc\cbc05;Initial Catalog=Northwind;User=sa;Password=P@ssw0rd"/>
  </connectionStrings>
 
  <system.web>
    <membership defaultProvider="SuperDuperMSProv">
      <providers>
        <clear/>
        <add name="SuperDuperMSProv" connectionStringName="MyNWind" type="MyMembershipProvider"/>
      </providers>
    </membership>

Step 5: View the auditing information - default.aspx.cs

The final "UI" looks like this:

The source code is rather simple:

protected void Page_Load(object sender, EventArgs e)
{
MyMembershipUser currentUser = (MyMembershipUser)Membership.GetUser();

Label1.Text = currentUser.FullName;
string lcConnection = ConfigurationManager.ConnectionStrings["MyNWind"].ConnectionString;

SqlConnection conn = new SqlConnection(lcConnection);

SqlCommand cmd = new SqlCommand("select * from myLoginAuditing where username=@username", conn);
cmd.Parameters.AddWithValue("@Username", currentUser.UserName);

conn.Open();

SqlDataReader reader = cmd.ExecuteReader();

GridView1.DataSource = reader;
GridView1.DataBind();

reader.Close();
conn.Close();
}

Done. By the way, did you notice something? Right! Alexander never fell into the trap of SQL Injection.

ExtendingMembershipProviderDemo.zip (5.64 KB)

Categories: 2 Ohhhh | ASP.NET | Community | Security
Monday, 25 July 2005 19:46:16 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Sunday, 26 June 2005
The German .NET community's July event, the ASP.NET 2.0 Community Boot Camp aka CBC05 is now fully booked! It feels absolutely great that we (speakers are almost exclusively MVPs) were able to organize a five day training event on ASP.NET 2.0 by the community for the community. See you in Bad Ischl in July!
Sunday, 26 June 2005 11:08:55 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Wednesday, 25 May 2005
Details on Brian Goldfarb's blog. Read the announcement / Go there
Categories: 2 Ohhhh | ASP.NET | Community | Visual Studio
Wednesday, 25 May 2005 23:55:01 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Thursday, 28 April 2005
I'll be off to Vienna tomorrow for the regional get-together. Camera is charging right next to me...
Categories: Community | this
Thursday, 28 April 2005 15:36:27 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Thursday, 10 March 2005
I just registered for the Community Day: Indigo in Munich (7th of April). Talks will be held by Christian Weyer and Darius Parys. It is free, so sign up.
Categories: .NET | Community
Thursday, 10 March 2005 02:37:56 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Tuesday, 08 March 2005

Carsten and I just returned from a Web Developer Meeting of the .NET Developers Association. For us, building forty is just a block away, so we decided to sit in on Michael Stiefel's talk on SOA. You can download the presentation and source code here.

Michael (who still remembered me from a book publishing summit waaay back) recommended that we (as in all attendees) check out the Metropolis Webcasts: Pat Helland relates the evolution of technology architectures to the evolution of city planning and shows us how far we have yet to go.

The Microsoft Architect Journal also has an article on Metropolis.

Categories: .NET | Community
Tuesday, 08 March 2005 06:28:48 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 09 February 2005

In my spare time (ok, some might argue about my definition of "spare time") I run the German ASP and .NET mailing lists, and my official title there is Bastard Listmaster from Hell (BLfH for short; me and my assistant have a German-language blog too).

That's not quite the point though. Both the assistant and himself are also tester on the #develop project, which led to the usual team Ts. Those were available for quite some time, but the shop language was German - but now Spreadshirt enabled us to switch to English, and the BLfH shop is now open for international business. Next task: add a cool T-shirt for .NET Golf. Oh, btw, a new hole starts today at 4pm CET, German-speaking programmers welcome!

Categories: Community | this
Wednesday, 09 February 2005 08:56:27 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Sunday, 30 January 2005

This year's community wintercamp is over - we had two great days spanning three days. Included here are only two photos - one from Friday's evening "Bratl in der Rein" in the restaurant Moststadl in Ebensee, and the second one from Saturday's skiing in the Dachstein West resort.

Friday

Saturday

Categories: Community | this
Sunday, 30 January 2005 19:29:41 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Friday, 21 January 2005

Next Friday, the German ASP and .NET communities will converge in Bad Ischl, Austria, for their annual non-technical meeting: the Community Wintercamp 2005. On the agenda, so to speak: skiing, sledging, local hospitality (not to mix up with local hospitals!) and a lesson in beer brewing as well as consumption. It looks like the weather is very, very kind to us too: snow all over the place and it'll keep snowing for the next few days. Hooray!

Categories: Community
Friday, 21 January 2005 12:44:21 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Sunday, 16 January 2005

Bernhard came back from the holidays with a great idea for our next hole of .NET Golf on the code fairway (currently only German, but we do plan to offer the fairway to non-German communities). We have ironed out the details, and come up with a test implementation together with Mike (of #develop fame). Hopefully, we'll (Alex, that is) also be able to get the automated tester up and running for this hole. In closing: this time, we do have a grand prize for the winner!

So, if you are German speaking and an avid .NET programmer, come join us on the fairway!

Categories: Community
Sunday, 16 January 2005 17:17:45 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 12 January 2005

It feels good to be no longer grounded by the doctor, especially because this means that my Webcast next week is no longer in danger of being cancelled: ".NET development for free with #develop" (MSDN: .NET-Entwicklung zum Nulltarif mit SharpDevelop is the orginial title, because this Webcast is in German). I will be talking about what cool things you can do with #develop, how it was built, and what the future holds for this free (cost-wise et al) lightweight development environment. Join Uwe and me on Monday 17th @ 4pm (understanding German being a rather big bonus).

Categories: .NET | Community | this
Wednesday, 12 January 2005 13:22:22 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Wednesday, 05 January 2005

I simply couldn't resist: Yes, I am again|still MVP for Visual Developer - ASP/ASP.NET. Admittedly, this doesn't quite reflect on this blog for a couple of reasons, the main one being that my MVP-worthyness stems from the time I do (bad pun intended) on German mailing lists and Web sites (see "Deutsche Resourcen" in the left-hand navigation bar to get an idea). In other news, I of course don't do community because of the award - it is a really nice recognition of my work on part of MS, and there of course is one  benefit of the MVP award that stands out: getting access to other community people around the globe as well as MS product teams, which allows me to get better information to my communities.

Categories: Community | this
Wednesday, 05 January 2005 09:59:29 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Monday, 22 November 2004

Last week I did a three day course for Peter's Sql Server User Group Austria (SSUGA). The reason it is part of the Summer Academy is that it originally was scheduled for summer, but I got the slot which ended up colliding with about everybody's holiday plans - so we decided to reschedule, and last week it finally happened (right smack when the snowfalls started... so much for the title).

What did we cover? Well, obviously not everything of the advanced stuff I planned, however we did get the basics covered very well, so we could build on that for DAAB, CodeSmith and Olymars. For the German-speaking among my blog readers, a more detailed course outline follows (like I said earlier, we did cover almost everything):

"Dieser Kurs richtet sich an professionelle Entwickler die für das Design und die Entwicklung von Daten-zentrierten, verteilten Applikationen verantwortlich sind. Teilnehmer haben bereits Erfahrung mit Visual Studio .NET 2003, bevorzugt im Bereich der Webapplikationsentwicklung. Die Kursbeispiele werden in C# präsentiert, die verwendete Datenbank ist die MSDE.

In diesem Kurs werden disconnected (DataSet) als auch connected Szenarien des ADO.NET Datenbankzugriff-APIs behandelt. Ebenso kommt XML Integration nicht zu kurz, Data Binding, Transaktionen sowie architekturelle Themen.

Inhalte:

  • ADO.NET Grundlagen / Architektur
  • Connected Szenarien
  • Disconnected Szenarien
  • Data Binding in WebForms and WinForms
  • DataSet/XML Integration, Typisierte DataSets
  • Design von Data Tier Komponenten, durchreichen von Daten über Tiers
  • Arbeiten mit dem SQL Server Centric .NET Code Generator
  • Provider Model Design Pattern"
Monday, 22 November 2004 19:55:39 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Saturday, 23 October 2004
This week Microsoft invited quite a few community influencers (I totally hate it when someone uses the term "community leader") to meet in Barcelona (Spain, Europe - just in case).
Categories: Community | this
Saturday, 23 October 2004 19:21:26 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



© Copyright 2017 Christoph Wille

newtelligence dasBlog 2.3.9074.18820
Subscribe to this weblog's RSS feed with SharpReader, Radio Userland, NewsGator or any other aggregator listening on port 5335 by clicking this button.   RSS 2.0|Atom 1.0  Send mail to the author(s)

 
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.