Journey into C#
Being a moderatly to quite skilled programmer since 15 years, the past four years PHP exclusive, I have for various reasons decided to take up C#.
This blog is for sharing my ups and downs with fellow C# coders, beginners and pros alike.
tisdag, november 30, 2004
A case of mistaken identity
I've been fooling around with this small application that I need to develop for my job. It's an on-line NDA form of sorts that we're going to show to the user everytime she logs in until she agrees to it. We then update the Active Directory with the date she signed it.
We are going to use a web server to present the form which means that I need to get my IIS up and running as a development server (which I though I had but there's some funk with the connection to the AD). It also means that I need to grab the users credentials from the client operating system.
After looking around the web, mostly MSDN, I found the WindowsIdentity class. After some more fiddling around I got it to grab the name of the currently logged in user:
Console.WriteLine("Username: " + WindowsIdentity.GetCurrent().Name);
Now, what I get here is the actual username, in our case something rather cryptic, so I need to query the AD for the display name, just for looks though when we display the form to the user.
From my C# book I got an example that displays all the properties of an AD object, including users, but I can't modify it to my needs. The original code looks like this:
foreach (string name in properties.PropertyNames)
{
foreach (object o in properties[name])
{
Console.WriteLine(name + ": " + o);
}
}
and I want to use something like this:
Console.WriteLine("\n\nDisplayName: " + properties["displayName"]);
It doesn't work though and at the moment I'm too tired to keep at it. I'll get back to it tomorrow or Thursday.
Oh, and I found a new C# site; C# Help. Well, new to me atleast.
onsdag, november 24, 2004
I've got an IDE
I finally got around to reinstalling the VS. NET 2003 IDE after I rebuilt and reinstalled my computer a month ago or so.
I've been dabbling in some C# ASP .NET development using a standard text editor but it's just too cumbersome to be worth it. The thing I'm pondering is how well I can adapt the VS .NET IDE to my PHP development.
Anyhow... With the IDE properly installed I should be able to get started on some more serious development, even though the small application I'm currently designing might not need too much serious development.
tisdag, november 16, 2004
Long time no see...
(Yeah, I could have gone with Long time no C#... but that seemed a bit too nerdy, even for me.)
So, why haven't I posted for months? The simple reason is that I've been fatigued due to an excessive amount of work. Things have been crazy at the office for quite a while now. Combine that with me working out 3-4 days a week and I'm spent once I get back home.
Things aren't all bad though as I've managed to squeeze out a couple of hours here and there on my spare time to do something useful. I have, for instance, discovered the glory of OOP. No, it's not in C#, unfortunately, it's in PHP, and version 4 to boot, but it's a big step in the right direction.
I have also managed to create a much better development environment here at home with a domain controller (for working on those AD-enabled applications), an IIS 6 webserver and an SQL 2000 server. As a bonus I even managed to get the IIS to run PHP 5 in ISAPI mode although that was a bitch to get up and running.
The reason I'm reviving this blog is twofold. First off, the workload has started to decrease a bit which means I'm not all worn out when I get home making it possible for me to get creative with the code. Secondly, we need to put together a small ASP .NET page that displays an end user agreement to all our users. When they agree, the AD needs to be updated with the information that they agreed and when.
Hopefully I'll be keeping a more steadfast updating schedule this time around, eh?
