Showing posts with label C Sharp. Show all posts
Showing posts with label C Sharp. Show all posts

Thursday, 18 August 2016

Random Password Generation in C#

Posted by : Manav Pandya




Random Password Generation in C#

In this tutorial i am trying to make easy password generation procedure either any of the field like :


  • User ID
  • Payment / Reservation Number
  • Travel ID
  • Patient ID
  • Product Number
  • Reciept Number


I have used simple logic here by using 1 to 9 number and alpha's , so that desired random number should be generated on basis of our criteria .



    public static string GetRandomPassword(int length)
    {
        char[] chars = "$%#@!*abcdefghijklmnopqrstuvwxyz1234567890?;:ABCDEFGHIJKLMNOPQRSTUVWXYZ^&".ToCharArray();
        string password = string.Empty;
        Random random = new Random();

        for (int i = 0; i < length; i++)
        {
            int x = random.Next(1,chars.Length);
            //Don't Allow Repetation of Characters
            if (!password.Contains(chars.GetValue(x).ToString()))
                password += chars.GetValue(x);
            else
                i--;
        }      
        return password;
    }


You may also like : Hello World Application C# R


Whatsapp Messages, Whatsapp Images, Whatsapp Status, Whatsapp DP, Good morning images, Good morning ganesha, whatsapp ganesha, good morning shiva, whatsapp shiva, jai shri krishna, whatsapp krishna, Jai shri ram, Jai hanuman images, jai mata di, motivational messages, whatsapp motivational images, whatsapp funny messages, bajarangbali images, saibaba images, moraribapu images, moraribapu quotes, Guajarati images, Hindi images, gujarati messages, hindi messages, ganesh chaturthi images, vinayak chaturthi images, ramnavami images, navratri images, raksha bandhan images, friendship day images, independence day images, republic day images, Indian national flag, happy makar sankranti images, uttarayan messages, Happy Holi Images, Valentine Day images, Diwali wishes, Happy Dipavali Images, Happy Dhanteras Images, happy janmashtami images, jalarambapa images, Happy Sunday Images, Happy Thursday Images, Happy Saturday Images,

ASP.NET , What is C# , Hello World app in C# , ASP.NET MVC Tutorials , C# Tutorials , Demo Project , Web API , MVC 4.0 , .NET Core 

andom Password generation in C# , What is C# , ASP.NET WITH C# , ASP.NET MVC , AngularJS , Bootstrap
Read More

Hello World Application in C#

Posted by : Manav Pandya


Hello World Application in C#

Hello World Application in C#




1.     Start Visual Studio.

2.  On the menu bar, choose File, New, Project. The New Project dialog box opens.

3. Expand Installed, expand Templates, expand Visual C#, and then choose Console Application.

4. In the Name box, specify a name for your project, and then choose the OK button. The new project appears in Solution Explorer.

5.  If Program.cs isn't open in the Code Editor, open the shortcut menu for Program.cs in Solution Explorer, and then choose View Code.

6.   Replace the contents of Program.cs with the following code.

7.     Choose the F5 key to run the project. A Command Prompt window appears that contains the line Hello World!


using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");
          Console.WriteLine("Manav Pandya");
          Console.WriteLine(“Press Enter Key to Stop Debugging.”);
            Console.ReadKey();
        }
    }
}

What is C# , ASP.NET , MVC , AngularJS , Hello World , First Applicatio , First project in C# , Wordpress , Bootstrap
Read More