Click here to Skip to main content
16,012,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone

I have a problem in my developing site.....
when user clicks forget password and they enter their email id....
After clicking submit button the user get their password in their email id......
then after If user refresh the page the same email again sent to their email id at second time...

To stop this problem what i want to do....


pls help me..................
Posted

1 solution

try this

XML
<div>
       <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
       <br />
       <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>


C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
       }


   }
   protected void Button1_Click(object sender, EventArgs e)
   {
       if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
       {
           Label1.Text = "Hello";
           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
 string str = "your code will save here or call save() method here";

       }
       else
       {
           Label1.Text = "Page Refreshed";
                 }

   }
   protected void Page_PreRender(object sender, EventArgs e)
   {
       ViewState["CheckRefresh"] = Session["CheckRefresh"];
   }
 
Share this answer
 
Comments
vivekx2 2-Mar-12 6:42am    
thank you for your support......
Bojjaiah 2-Mar-12 7:19am    
then accept as a answer.any way
all ways welcome
vivekx2 2-Mar-12 6:43am    
Your coding will stop email when receving second time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900