Ads 468x60px

Friday, September 9, 2011

how to encrypt password in using C#

if you are searching for an encrypting password hashing algorithm than you are at right place, make sure before using this method that this algo is one way, means it has no decrypt method. just copy and past
here is the code for your aspx.cs file.

firstly include following files.
using System.Security.Cryptography;
using System.Text;
here is the function call.
protected void LoginButton_Click()

   txt_lable.Text = getEncryptedCode(txt_passwrod.Text);

 public static string getEncryptedCode(string inputString)
            byte[] tmpSource;
            byte[] tmpHash;
            int index = 0;
            int hashLength = 0;
            tmpSource = ASCIIEncoding.ASCII.GetBytes(inputString);
            tmpHash = new SHA512Managed().ComputeHash(tmpSource);
            hashLength = tmpHash.Length;
            StringBuilder outputString = new StringBuilder(hashLength);
            for (index = 0; index < hashLength; index++)
            return outputString.ToString();

Heading Types in HTML

there are 6 type of heading in html

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading
This is a heading

how to make simple html page

HTML stands for Hyper Text Markup Language, in order to make a simple html page you just need to copy the below code in any editor such as note pad or you can use Dream viewer, and save the file as test.html
here is the code
     Page Title

Hello World This is My first HTML page.

Thursday, September 8, 2011

how to get server side text box value on client side using javascript

in order to access a text box or lable or any form element of server side to client side using javascript than just copy the blew code and that's it.

redirect in

it is very simple to redirect your webpage to another webpage or just to another website just copy the below code in the event where you want to use.

code for aspx.cs

how to disable the button on page load Server side

Mention blow code will help you to make an button disable on server side page load event you can use it as per your requirement i.e. onclick event or where ever your want.

Code in .aspx page

Code aspx.cs File
protected void Page_Load(object sender, EventArgs e)
    Button1.Enabled = false;

Print using Javascript

Mention below code will help you to print the data in a div tag and is 100% tested on all browsers, you just need to copy and past and change the parameter as per your requirement..

Function call on button's onclientClick event

copy the below code under Javascript tag

Monday, June 20, 2011

Import Gmail Contact and Email Address in c#

1)  add these dll in you application:- 
Right click on Solution Explorer and add reference option.
using Google.Contacts;
    using Google.GData.Client;
    using Google.GData.Contacts;
    using Google.GData.Extensions;
2) Drag a button which name is "ImportContact" and a TextBox for enter the email id and drag another TextBox for enter the password.  and a listBox for show the contact and email address.
3)  Write this code to Button_Click:--
//Provide Login Information 
RequestSettings rsLoginInfo = new RequestSettings("", txtEmail.Text, txtPassword.Text);
        rsLoginInfo.AutoPaging = true;
// Fetch contacts and dislay them in ListBox
view sourceprint?

ContactsRequest cRequest = new ContactsRequest(rsLoginInfo);

Feed feedContacts = cRequest.GetContacts();

foreach (Contact gmailAddresses in feedContacts.Entries)


    Console.WriteLine("\t" + gmailAddresses.Title);


    foreach (EMail emailId in gmailAddresses.Emails)


        Console.WriteLine("\t" + emailId.Address);

        lstContacts.Items.Add(" " + emailId.Address);




How To Add Tool Tip for DropDownList items in Asp.Net

1<asp:DropDownList ID="DropDownList1" runat="server" ondatabound="DropDownList1_DataBound">

Code for .CS File

protected void DropDownList1_DataBound(object sender, EventArgs e)
03    DropDownList ddl = sender as DropDownList;
04    if (ddl != null)
05    {
06        foreach (ListItem li in ddl.Items)
07        {
08           li.Attributes["title"] = li.Text; // setting text value of item as tooltip
09        }
10    }