Picklist Bundle Assistant – Now with Integrated Bundler
Posted By: nicocrm on December 29th, 2008 in Uncategorized
No Gravatar

Laziness being what it is I got tired of having to open and save each project separately after my bundle assistant created them and added an option to generate the bundle files directly from the tool.

It’s not perfect but it does what I need (except for a better interface to capture the picklist values – maybe next time).

image


Picklist Bundle Assistant
Posted By: nicocrm on December 26th, 2008 in Uncategorized
No Gravatar

Today I finally broke down.  Confronted with the task of creating 15 picklist bundles I decided to (slightly) automate the task with a tool.  It is very simple (does what I need and nothing more) – basically given a list of picklist names (the picklists must already exist) it will create the corresponding projects.

image

I think in the near future I will prepare an improvement to also make it easier to enter the picklist values (right now I use the import feature from the Architect but it still require you to create and set up the picklists one by one) – but that’s for another day.

The code is available on MSDN Code Gallery.


Authenticate Users with Active Directory (in ASP.NET 1.1)
Posted By: nicocrm on December 19th, 2008 in Uncategorized
No Gravatar

If you need to authenticate user logins against their Active Directory credentials, integrated authentication is often preferable since it is automatic but it is not always possible.  Given clear text user name and password, how can we do it?

A quick search will turn up a lot of ways:

  • Use the LogonUser API (possibly not recommended as this is really used to impersonate a user, not just validate their login, but it appears if you use LOGON32_LOGON_NETWORK as logon type then it is a valid way to do it)
  • Use the SSPI API – I’ll admit I was not able to go through that document
  • Use an LDAP connection object (with a special OleDb provider)
  • Use an LDAP object (with the GetObject call in VBScript – not sure what the equivalent is in C# though)
  • Use the System.DirectoryServices

Of the above the DirectoryServices is the only one that worked for me on ASP.NET 1.1. 

The authentication procedure looked something like this:

private bool ValidateLogin(String user, String pw)
{
  DirectoryEntry e = new DirectoryEntry("GC://DOMAIN", user, pw, AuthenticationTypes.Secure);
  try {
    if(e.Name != null)
      return true;
  } catch {
    // exception means the logon failed
    return false;   
  }
  // should not be reached
  return false;
}

The “GC://DOMAIN” part was the little trick… first I tried “WinNT://DOMAIN/USER” and found out new users were not able to log in.  You can also use a full LDAP query string.