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
- <form id="form1" runat="server">
- <div>
- <asp:Label runat="server" ID="name"></asp:Label>
- <br />
- <asp:Label runat="server" ID="Mobile"></asp:Label>
- </div>
- <asp:Button runat="server" ID="clickme" OnClick="clickme_Click" Text="test me " />
- </form>
Button click event - protected void clickme_Click(object sender, EventArgs e)
- {
- name.Text = Getemail("[email protected]");
- Mobile.Text = GetMobile("1234567890");
- }
Get a Email ID- public string Getemail(string Name)
- {
- if (Name.Length < 1)
- {
- Response.Write("No records found");
- }
- else
- {
- for (i = 0; i < Name.Length; i++)
- {
- if (i >= 2)
- {
-
- if (Name[i] != _char)
- {
- temp += "*";
-
- }
- else
- {
- temp += Name[i];
- break;
- }
- }
- else
- {
- temp += Name[i];
- }
- }
-
- for (int m = i + 1; m < Name.Length; m++)
- {
- temp += Name[m];
- }
-
- }
- return temp;
- }
Get a Mobile No- public string GetMobile(string Mobile)
- {
- temp = string.Empty;
- if (Mobile.Length < 1)
- {
- temp = "No Mobile no found";
-
- }
- else
- {
- for (int i = 0; i < Mobile.Length; i++)
- {
- if (i < 1)
- {
- temp += Mobile[i];
- }
- else
- {
- if (i+1 == Mobile.Length)
- {
- temp += Mobile[i];
- }
- else
- {
- temp += "*";
- }
- }
-
- }
- }
- return temp;
- }
Final Output of code
Last word
I know this is not a big code but i share with any one help.