In my small life, I have forgot password lot of times. We have lot of options are there recover any password, link send email id, get a OTP(One Time Password) password on mobile and so on.

In Front page we take two label and another one is button. Label showing email ID and Mobile No.
HTML Page structure
  1. <form id="form1" runat="server">
  2. <div>
  3. <asp:Label runat="server" ID="name"></asp:Label>
  4. <br />
  5. <asp:Label runat="server" ID="Mobile"></asp:Label>
  6. </div>
  7. <asp:Button runat="server" ID="clickme" OnClick="clickme_Click" Text="test me " />
  8. </form>
Button click event
  1. protected void clickme_Click(object sender, EventArgs e)
  2. {
  3. name.Text = Getemail("[email protected]");
  4. Mobile.Text = GetMobile("1234567890");
  5. }
Get a Email ID
  1. public string Getemail(string Name)
  2. {
  3. if (Name.Length < 1)
  4. {
  5. Response.Write("No records found");
  6. }
  7. else
  8. {
  9. for (i = 0; i < Name.Length; i++)
  10. {
  11. if (i >= 2)
  12. {
  13. if (Name[i] != _char)
  14. {
  15. temp += "*";
  16. }
  17. else
  18. {
  19. temp += Name[i];
  20. break;
  21. }
  22. }
  23. else
  24. {
  25. temp += Name[i];
  26. }
  27. }
  28. for (int m = i + 1; m < Name.Length; m++)
  29. {
  30. temp += Name[m];
  31. }
  32. }

  33. return temp;
  34. }
Get a Mobile No
  1. public string GetMobile(string Mobile)
  2. {
  3. temp = string.Empty;
  4. if (Mobile.Length < 1)
  5. {
  6. temp = "No Mobile no found";
  7. }
  8. else
  9. {
  10. for (int i = 0; i < Mobile.Length; i++)
  11. {
  12. if (i < 1)
  13. {
  14. temp += Mobile[i];
  15. }
  16. else
  17. {
  18. if (i+1 == Mobile.Length)
  19. {
  20. temp += Mobile[i];
  21. }
  22. else
  23. {
  24. temp += "*";
  25. }
  26. }
  27. }
  28. }
  29. return temp;
  30. }
Final Output of code
Last word

I know this is not a big code but i share with any one help.