ASP.NET 2.0 Forms Authentication Using Access Database

March 4, 2007 at 5:56 PMAmer Gerzic

Introduction

Authentication and authorization is one of the basic components of web application development. When I first started web development, I quickly realized that authentication and authorization of resources were performed in variety of ways. Throughout years, I developed variety of web applications, primarily for my own use. With arrival of ASP.NET 1.0, authentication and authorization were simplified. ASP.NET 2.0 takes this feature even further by providing the user with powerful tools to quickly implement authentication and authorization. With these tools, a user can utilize MS SQL 2005 Server, XML data source, MS Access database and other data sources to retrieve user information. In this article I will focus on bare minimum needed to implement forms authentication using access database.

More...

Posted in: ASP.NET | C#

Tags: , , , , , ,

Enumerating System Devices on Windows

August 11, 2006 at 5:09 PMAmer Gerzic

Occasionally an application execution depends on installed devices. For example, USB memory card might be needed for storing/reading application specific files. But how do we know that such device is inserted/installed on the system?

Below is the code that enumerates all installed devices on a windows system.

HDEVINFO hInfoList = ::SetupDiGetClassDevs(NULL, NULL, NULL,
        DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_PROFILE);
if(hInfoList != INVALID_HANDLE_VALUE)
{
    SP_DEVINFO_DATA spdid;
    spdid.cbSize = sizeof(SP_DEVINFO_DATA); 

    DWORD dwIndex = 0;
    while(::SetupDiEnumDeviceInfo(hInfoList, dwIndex, &spdid))
    {
        CString strEntry = _T(""); 

        TCHAR szName[4096] = {0}; 

        if(::SetupDiGetClassDescription(&spdid.ClassGuid, 
                                        szName, 
                                        4096, 
                                        NULL))
        strEntry += szName;
        strEntry += " | "; 

        if(::SetupDiGetDeviceRegistryProperty(hInfoList, &spdid, SPDRP_DEVICEDESC, 0,
            (PBYTE)szName, 4096, 0))
        {
            strEntry += szName;
        }
        
        strEntry += " | "; 

        if(::SetupDiGetDeviceRegistryProperty(hInfoList, 
                &spdid, SPDRP_FRIENDLYNAME, 0, 
                (PBYTE)szName, 4096, 0))
        {
            strEntry += szName;
        } 

        m_DevList.AddString(strEntry); 

        ++dwIndex;
    }
} 

::SetupDiDestroyDeviceInfoList(hInfoList);

Posted in: CPP | Win32 API

Tags: , , , , ,

Programmatically determine endianess of the host machine

August 4, 2006 at 5:16 PMAmer Gerzic

Couple of days ago I was asked by a fellow software developer the question regarding endianess of host machine. The question was if there is an easy way to determine if a host machine is little or big endian. At first, I was somewhat shocked that such a simple question was not already answered throughout his carrier. But then I realized that he is a VB developer (no offense intended) and that he never had to deal with questions like this. Also, I realized with growing popularity of .NET and Java, the separation between software implementation and hardware is growing exponentially. It is reality that some software developers will probably spend whole life developing successful applications without even knowing that endianess exists. Is this a good or bad thing, I leave the reader to decide.

Getting back to the question, I wrote little example that would determine if machine is little or big endian. Here is the code:

#include <iostream>
using namespace std; 

int main(int argc, char* argv[])
{
    unsigned int x = 0x00000001;
    unsigned char *p = (unsigned char*)&x;
    if(p[0]=1)
        cout << "The machine is little-endian" << endl;
    else cout << "The machine is big-endian" << endl; 

    return 0;
}

Posted in: CPP | Win32 API

Tags:

Book Review: Programming MS Windows Driver Model

July 18, 2006 at 10:32 AMAmer Gerzic

Programming MS Windows Driver Model, by Walter Oney touches every aspect of Windows Driver Development. At first, the author describes "Basic Structure of a WDM Driver" and "Basic Programming Techniques". After covering basics, the author dives into dark areas of driver development. Driver development is based on Windows Driver Development Kit.

Generally, the book can be considered as valuable resource for every driver developer. However, on occasion, the reader is left wondering about certain details of a topic.

 

Posted in: Bookshelf

Tags:

HandHeld Pocket PC 2003 Automatic Software Installation

June 3, 2006 at 5:21 PMAmer Gerzic

Recently I had to write a program that runs on Pocket PC 2003 and utilizes built-in barcode scanner (HandHeld product). Writing software was simple; Installation was even simpler. However, every time I performed hard-reset, my newly installed software disappeared. I quickly noticed that HandHeld demos were installed automatically, so I started research. Looking on the web did not reveal much. I assumed that there is a special folder where such autoinstalls are stored. After short time I found the folder:

      IPSM/AutoInstall/

Simply copy *.cab file inside this folder and your program will be installed at each hard reset.

I looked into regular Pocket PC 2002 and could not find the same folder, which leads me to believe that this could be HandHeld device specific.

Posted in: PocketPC

Tags: ,