Skip to main content

Posts

Showing posts from July, 2006

Lets learn C

The C Journey Lesson One : Introduction C is everywhere, though .net, java, python is taking the world by storm. It is still one of the fundamental language to learn beginning programming. Though some may argue the case to be otherwise, but this is the way which worked best for me. Lets get to the heart of the matter. Every C program begins with a main() function. main() is the entry point for a C program. Let's write our first program, which is a hello world. #include stdio.h /* This program prints "Hello World" on the console. */ void main() { printf("Hello World\n"); } The above program highlights many important features of C. Note the include file "stdio.h". The printf() function is located in this header file. You can treat stdio.h as a library containing many input/output functions. Later on we will see how to write our own such library. Compile this program in your favorite editor and run it. You will be greeted with a "Hello W

Build your own Forms Authentication

The authentication ticked is created with the FormsAuthenticationTicket class. Its constructor accepts the following parameters: version : The version of the authentication ticket[this value will be one] name : The user name associated with the authentication ticket issueDate : The date that the authentication ticket was issued expiration : The date that the authentication ticket should expire isPersistent: A boolean value indicating whether to allow the ticket to persist after the user closes the browser userData : A string value of any data that you would like to store. For eg., say your email ID. Add an asp.net form, with a button 'Create Ticket'. On click on this button invoke the 'Login' method. void Login(Object s, EventArgs e) { if (txtUsername.Text == "xxx" && txtPassword.Text == "xxx") { FormsAuthenticationTicket objTicket; HttpCookie objCookie; objTicket = new