host tutorialASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services.

It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft’s Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.

ASP.NET is in the process of being re-implemented as a modern and modular web framework, together with other frameworks like Entity Framework. The new framework will make use of the new open-source .NET Compiler Platform (code-name “Roslyn”) and be cross platform. ASP.NET MVC, ASP.NET Web API, and ASP.NET Web Pages (a platform using only Razor pages) will merge into a unified MVC 6. The project is called ASP.NET Core.

In this article I am going to share how to generate or create random unique alphanumeric one time password (OTP) in Asp.Net using both C# and VB.

otp final

 

Nowadays one time password(OTP) system is widely used by banks and other firms to authenticate users while making online transactions and other similar activities. Here I have created a function to generate OTP which is combination of numbers, lower and uppercase letters and special characters or symbols.

I have added only few special characters while generating OTP but you can add as many as special characters as required to make it more unique. It generates the OTP of the length we specify. E.g. if we pass 10 from the textbox, it will generate OTP of length 10. OTP can be generated of any length as per requirement. Generated OTP can be sent through Email or SMS to user for authentication.

Let’s create a sample web page for demonstration purpose

Asp.Net C# Code to generate One Time Password(OTP)

 

Asp.Net VB Code to generate One Time Password(OTP)

Recommendation Best & Cheap Hosting ASP.NET

asphostportal-icon-e1421832425840-120x120-e1424663413602ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.6, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch. Click here for more information
ASP.NET Hosting Tutorial – Generate Random Unique in ASP.NET