Introduction: In this article I am
going to explain with example How to create registration form and approve newly registered user by sending them account activation link on their email address in asp.net
with both C#.Net and VB.Net languages.
First of all create a database
e.g. “MyDataBase” in Sql server and create a table with the column and the data type as shown and name it “Tb_Registration”
Description: The concept is
simple as mentioned below.
- First user will fill the form having Name, Email Id, Address and Contact Number field. This information will be stored in the Sql server database table where a field “Is_Approved” is set to 0 i.e. false by default.
- Also email id, and the user id based on email id is set in the query string parameters and sent to the email address of the newly registered user as an activation link.
- When user check his email and click on the activation link then he will be redirected to the "ActivateAccount.aspx" page where User id and email Id from the query string will be verified and the “Is_Approved” field in the sql server table is set to 1 i.e. True.
- Now he is an approved user and authorized to log in.
In previous related article i explained How to create Login page/form and check username,password in asp.net using sql server database and Create Change password form/page in asp.net using Sql server and Encrypt and decrypt username,password and store in Sql Server database and Create contact us form and Recover and reset the forgot password using activation link in email id and Check login in asp.net by passing parameter to stored procedure in sql server .
Implementation: let’s create an
asp.net web application to understand the concept.
Click on the image to enlarge |
Note: I have set the data type of
the Is_Approved field to bit and set its default value to 0 i.e. false. It means
whenever a new record is inserted in the table the “Is_Approved” will be 0. So
the new users need to get their account approved by clicking on the activation
link in their email address.
- In the web.config file create the connection string to connect your asp.net application to the Sql server database as:
<connectionStrings>
<add name="conStr" connectionString="Data Source=lalit;Initial Catalog=MyDataBase;Integrated
Security=True"/>
</connectionStrings>
Note: Replace the Data Source and Initial Catalog(i.e. DataBase Name) as per your application.
Source Code:
- Add a page and name it “Registration.aspx” and design the page as:
<div>
<fieldset style="width:350px;">
<legend>Registeration page</legend>
<table>
<tr>
<td>Name *: </td><td>
<asp:TextBox ID="txtName"
runat="server"></asp:TextBox><br /><asp:RequiredFieldValidator
ID="rfvName"
runat="server"
ErrorMessage="Please
enter Name"
ControlToValidate="txtName" Display="Dynamic" ForeColor="#FF3300"
SetFocusOnError="True"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Email Id: * </td><td>
<asp:TextBox ID="txtEmailId"
runat="server"></asp:TextBox><br />
<asp:RequiredFieldValidator
ID="rfvEmailId"
runat="server"
ControlToValidate="txtEmailId"
Display="Dynamic"
ErrorMessage="Please
enter Email Id" ForeColor="Red" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="rgeEmailId"
runat="server"
ControlToValidate="txtEmailId"
Display="Dynamic"
ErrorMessage="Please
enter valid email id format" ForeColor="Red"
SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>Address : </td><td>
<asp:TextBox ID="txtAddress"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Contact No.</td><td>
<asp:TextBox ID="txtContactNo"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td> </td><td>
<asp:Button ID="btnSubmit"
runat="server"
Text="Submit"
onclick="btnSubmit_Click"
/></td>
</tr>
</table>
</fieldset>
</div>
Note: I have also implemented the
validation on Name and the Email Id field to ensure they are not left blank
using RequiredFieldValidator validation control and also used RegularExpressionValidator to check for the valid email address on the Email Id field.
Asp.Net C# Code for Registration.aspx
- In the code behind file (Registration.aspx.cs) write the code as:
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using System.Net;
using System.Net.Mail;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString);
protected void
btnSubmit_Click(object sender, EventArgs e)
{
MailMessage msg;
SqlCommand cmd = new
SqlCommand();
string ActivationUrl = string.Empty;
string emailId = string.Empty;
try
{
cmd = new SqlCommand("insert into Tb_Registration
(Name,EmailId,Address,ContactNo) values (@Name,@EmailId,@Address,@ContactNo)
", con);
cmd.Parameters.AddWithValue("@Name",
txtName.Text.Trim());
cmd.Parameters.AddWithValue("@EmailId",
txtEmailId.Text.Trim());
cmd.Parameters.AddWithValue("@Address",
txtAddress.Text.Trim());
cmd.Parameters.AddWithValue("@ContactNo",
txtContactNo.Text.Trim());
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.ExecuteNonQuery();
//Sending activation link in
the email
msg = new MailMessage();
SmtpClient smtp = new SmtpClient();
emailId = txtEmailId.Text.Trim();
//sender email address
msg.From = new MailAddress("YourGmailEmailId@gmail.com");
//Receiver email address
msg.To.Add(emailId);
msg.Subject = "Confirmation email for
account activation";
//For testing replace the local host path with
your lost host path and while making online replace with your website domain
name
ActivationUrl = Server.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID="
+ FetchUserId(emailId) + "&EmailId="
+ emailId);
msg.Body = "Hi " +
txtName.Text.Trim() + "!\n" +
"Thanks for showing interest and
registring in <a href='http://www.webcodeexpert.com'> webcodeexpert.com<a>
" +
" Please <a href='" +
ActivationUrl + "'>click here to
activate</a> your account and
enjoy our services. \nThanks!";
msg.IsBodyHtml = true;
smtp.Credentials = new NetworkCredential("YourGmailEmailId@gmail.com",
"YourGmailPassword");
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.Send(msg);
clear_controls();
ScriptManager.RegisterStartupScript(this, this.GetType(),
"Message", "alert('Confirmation Link to activate your account has been sent
to your email address');", true);
}
catch (Exception
ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(),
"Message", "alert('Error occured : " + ex.Message.ToString() + "');", true);
return;
}
finally
{
ActivationUrl = string.Empty;
emailId = string.Empty;
con.Close();
cmd.Dispose();
}
}
private string
FetchUserId(string emailId)
{
SqlCommand cmd = new
SqlCommand();
cmd = new SqlCommand("SELECT UserId FROM Tb_Registration WHERE
EmailId=@EmailId", con);
cmd.Parameters.AddWithValue("@EmailId",
emailId);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string UserID = Convert.ToString(cmd.ExecuteScalar());
con.Close();
cmd.Dispose();
return
UserID;
}
private void
clear_controls()
{
txtName.Text = string.Empty;
txtEmailId.Text = string.Empty;
txtAddress.Text = string.Empty;
txtContactNo.Text = string.Empty;
txtName.Focus();
}
- Add a new page and name it “ActivateAccount.aspx”. This page will be opened when new registered user click on the activate account link in his email. On the page load it will check email id and user id from the query string and then update the "Is_Approved" column to 1 i.e. True. Then you can redirect him to your login page to log in.
Code for ActivateAccount.aspx
page
- In the code behind file (ActivateAccount.aspx.cs) write the code as:
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
protected void Page_Load(object
sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ActivateMyAccount();
}
}
private void
ActivateMyAccount()
{
SqlConnection con = new
SqlConnection();
SqlCommand cmd = new
SqlCommand();
try
{
con = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString);
if ((!string.IsNullOrEmpty(Request.QueryString["UserID"])) & (!string.IsNullOrEmpty(Request.QueryString["EmailId"])))
{ //approve
account by setting Is_Approved to 1 i.e. True in the sql server table
cmd = new SqlCommand("UPDATE Tb_Registration SET Is_Approved=1 WHERE
UserID=@UserID AND EmailId=@EmailId", con);
cmd.Parameters.AddWithValue("@UserID",
Request.QueryString["UserID"]);
cmd.Parameters.AddWithValue("@EmailId",
Request.QueryString["EmailId"]);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.ExecuteNonQuery();
Response.Write("You account has been
activated. You can <a href='Login.aspx'>Login</a> now! ");
}
}
catch (Exception
ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(),
"Message", "alert('Error occured : " + ex.Message.ToString() + "');", true);
return;
}
finally
{
con.Close();
cmd.Dispose();
}
}
Asp.Net VB Section:
Source code of Registration.aspx
- Design the Registration.aspx page as in C#.Net section but replace the line
<asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" /> With <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
"If you like my work; you can appreciate by leaving your comments,
hitting Facebook like button, following on Google+, Twitter, Linked in and
Pinterest, stumbling my posts on stumble upon and subscribing for receiving
free updates directly to your inbox . Stay tuned and stay connected for more
technical updates."
VB.Net Code for Registration.aspx
page
- In the code behind file (Registration.aspx.vb) write the code as:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Text
Imports System.Net
Imports System.Net.Mail
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("conStr").ConnectionString)
Protected Sub
btnSubmit_Click(sender As Object, e As System.EventArgs) Handles
btnSubmit.Click
Dim msg As MailMessage
Dim cmd As New SqlCommand()
Dim ActivationUrl As String = String.Empty
Dim emailId As String = String.Empty
Try
cmd = New SqlCommand("insert into Tb_Registration
(Name,EmailId,Address,ContactNo) values (@Name,@EmailId,@Address,@ContactNo)
", con)
cmd.Parameters.AddWithValue("@Name",
txtName.Text.Trim())
cmd.Parameters.AddWithValue("@EmailId",
txtEmailId.Text.Trim())
cmd.Parameters.AddWithValue("@Address",
txtAddress.Text.Trim())
cmd.Parameters.AddWithValue("@ContactNo",
txtContactNo.Text.Trim())
If con.State = ConnectionState.Closed
Then
con.Open()
End If
cmd.ExecuteNonQuery()
‘Sending
activation link in the email
msg = New MailMessage()
Dim smtp As
New SmtpClient()
emailId = txtEmailId.Text.Trim()
'sender email address
msg.From = New MailAddress("YourGmailEmailId@gmail.com")
'Receiver email address
msg.[To].Add(emailId)
msg.Subject = "Confirmation email for
account activation"
'For testing replace the local host path with
your lost host path and while making online replace with your website domain
name
ActivationUrl = Server.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID="
& FetchUserId(emailId) & "&EmailId="
& emailId)
msg.Body = "Hi " &
txtName.Text.Trim() & "!"
& vbLf & "Thanks for showing interest
and registring in <a href='http://www.webcodeexpert.com'>
webcodeexpert.com<a> " & "
Please <a href='" & ActivationUrl & "'>click here to activate</a> your account and enjoy our services. "
& vbLf & "Thanks!"
msg.IsBodyHtml = True
smtp.Credentials = New NetworkCredential("YourGmailEmailId@gmail.com",
"YourGmailPassword")
smtp.Port = 587
smtp.Host = "smtp.gmail.com"
smtp.EnableSsl = True
smtp.Send(msg)
clear_controls()
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Confirmation
Link to activate account has been sent
to your email address');", True)
Catch ex As Exception
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Error
occured : " & ex.Message.ToString() & "');", True)
Return
Finally
ActivationUrl = String.Empty
emailId = String.Empty
con.Close()
cmd.Dispose()
End Try
End Sub
Private Function
FetchUserId(emailId As String)
As String
Dim cmd As New SqlCommand()
cmd = New SqlCommand("SELECT UserId FROM Tb_Registration WHERE
EmailId=@EmailId", con)
cmd.Parameters.AddWithValue("@EmailId",
emailId)
If con.State
= ConnectionState.Closed Then
con.Open()
End If
Dim UserID As String = Convert.ToString(cmd.ExecuteScalar())
con.Close()
cmd.Dispose()
Return UserID
End Function
Private Sub clear_controls()
txtName.Text = String.Empty
txtEmailId.Text = String.Empty
txtAddress.Text = String.Empty
txtContactNo.Text = String.Empty
txtName.Focus()
End Sub
- Add a new page “ActivateAccount.aspx”. This page will be opened when new registered user click on the activate account link in his email. On the page load it will check email id and user id from the query string and then update the "Is_Approved" column to 1 i.e. True. Then you can redirect him to your login page to log in.
In the code behind file (ActivateAccount.aspx.vb)
and write the code on the page load event as:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Protected Sub Page_Load(sender As
Object, e As
System.EventArgs) Handles
Me.Load
If Not
Page.IsPostBack Then
ActivateMyAccount()
End If
End Sub
Private Sub ActivateMyAccount()
Dim con As New SqlConnection()
Dim cmd As New SqlCommand()
Try
con = New SqlConnection(ConfigurationManager.ConnectionStrings("conStr").ConnectionString)
If (Not String.IsNullOrEmpty(Request.QueryString("UserID"))) And
(Not String.IsNullOrEmpty(Request.QueryString("EmailId"))) Then
'approve account by setting Is_Approved to 1
i.e. True in the sql server table
cmd = New SqlCommand("UPDATE Tb_Registration SET Is_Approved=1 WHERE
UserID=@UserID AND EmailId=@EmailId", con)
cmd.Parameters.AddWithValue("@UserID",
Request.QueryString("UserID"))
cmd.Parameters.AddWithValue("@EmailId",
Request.QueryString("EmailId"))
If
con.State = ConnectionState.Closed Then
con.Open()
End If
cmd.ExecuteNonQuery()
Response.Write("You account has been
activated. You can <a href='Login.aspx'>Login</a> now! ")
End If
Catch ex As Exception
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Error
occured : " & ex.Message.ToString() & "');", True)
Return
Finally
con.Close()
cmd.Dispose()
End Try
End Sub
Now over to you:
108 comments
Click here for commentsFine Job but to send random password to user mail.
ReplyGreat work :)Keep blogging!!
Replythanks for the appreciation. stay tuned and stay connected for more useful updates..
Replyhii sir, i have followed ol ur code, bt still my code nt works.. wat to do in this case????
ReplyPlease let me know the exact problem you are facing so that i can help you resolve that..
Replysir why you are use Parameter variable without storedprocedure.
Replyplease sir tell me the role of it.
Hello Danish..It is good programming practice and prevents from Sql injection and other hacking..So never pass the value to variable directly from the textbox,instead use this approach.
Replythankyou sir
Replysir how i decide the name of parameter variable.is it the name of database table variable with @sign.
what is the use of cmd.ExecuteScalar() and Server.HtmlEncode
your code is very helpful to me .
Hello Danish Khan, parameters name can be anything with the @ prefix..
ReplyExecuteScalar executes the query and returns the very first column of first row, other columns and rows are ignored by this method.Basically it is used to retrieve single value from database.
The HTMLEncode method applies HTML encoding to a specified string.
I will try to create post related to the above so that you can better understand the concept.
thank u sir
Replysir please create post. that discribed how to genrate pdf file in asp.net
sorry sir i want ask you another query
Replyrelated to this program. UserId is a primary key and it doesnt repeated in table .but emailId and contact number genrated ambigulty
we can easily inserted same emailId and contact no into another record.please tell me the solution
Hi Danish..Read the below mentioned article to export gridview data to create pdf file http://www.webcodeexpert.com/2013/06/bind-and-export-gridview-data-to-pdf.html
ReplyDear Sir,
ReplyI want to convert a panel content into pdf file but i have not used table,tr and td anywhere inside panel content. i have used only div and css inside panel. when i am trying to convert in pdf its giving exception 'the page source is empty' like that type of message. is it possible to write div content in .pdf format using iTextSharp ?. Please help me..
When i am using table ,tr and td then its writing in pdf
but i am not able to provide a good look and feel in table,tr and td..
So ,please reply me how to write a div content.
when i click on button. it doesn't send the email and doesn't give any message. there is no any errors. can you upload the whole project of this email example??
ReplyHello chirag..Check your spam emails. sometime mails goes in the spam folder. Also have you changed the localhost path as per your application in the line
ReplyServer.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&EmailId=" + emailId);
Please check and notify me..
sir please give me the solution of my problum
ReplyYou can create emailid and contact number field the unique key..this way they can not be duplicated..
ReplyHello danish..You can create emailid and contact number field the unique key..this way they can not be duplicated..
Replythank you sir.
Replysir please create a post about sharepoint.
Hello Danish Khan..right now i am not covering sharepoint..but i will cover it in near future..keep reading..:)
Replythankyou sir for response
ReplyYour welcome danish..:)
Replyhi sir,how send sms from asp.net website using way2sms
Replyhello..i will post an article to send sms from asp.net as soon as possible..so stay connected for more useful updates. :)
Replysir activation page is not working please let know what is process?
ReplyHi Mithlesh..exactly what problem you are facing?
ReplyHii sir, i want to create pdf file and send it to the user. Give me guidelines for it.
Replywhen i click on button. it doesn't send the email and doesn't give any message. there is no any errors. Pls help me
ReplyHello Thilaga R..Check your spam emails also. sometime mails goes in the spam folder. Also have you changed the localhost path as per your application in the line
ReplyServer.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&EmailId=" + emailId);
Please check and notify me..
i checked that...but no use..its urgent pls help me
ReplyHave you tried debugging the code? if not then i suggest you to do that to know the exact problem in you code..check and notify me where you are getting error?
Replythere is no any errors sir. can you upload the whole project of this email?? because i m doing one project
Replyhello sir , how to get userid based on emailid and what is the FetchUserid ?
ReplyActivationUrl = Server.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&EmailId=" + emailId);
hello sir , what is the FetchUserid and how to get userid from database?
Replythe following query
ActivationUrl = Server.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&EmailId=" + emailId);
Hi, srikanth kalyan..FetchUserid is the function to get the userid based on entered email id. Userid is the primary key and will be unique always..
Replythanks lalit sir,
Replyi saw for ur activation link Blog.
Your welcome roushan choudhary..stay connected and keep reading..:)
Replyhow to generate random password that send to email id after registration is over...and that password is used for login..
Replyhow to create auto generate passwords and send it newly created user email id....
Replyhow to write code for auto generate password and send it to newly create user email id?
ReplyHello Santu..i will create an article as per your requirement and publish as soon as possible..so stay connected and keep reading for more updates..:)
ReplyGreat work thanks for this example!
ReplyHello Jeremy W..thanks for appreciating my work..keep reading and stay connected for more useful updates like this..:)
ReplyThanks for the wonderful tutorial.Graspable coding for beginners....
ReplyIt is always nice to hear that my tutorial helped anyone..Thanks Raasitha..:)
ReplyVery good sir
Replythanks for the appreciation...:)
Replyhello sir i want to create a inquiry form & when ever from fill by user then all information send in my email ///////////i am very confuse pls help me
ReplyHi, read the following article:
Replyhttp://www.webcodeexpert.com/2013/08/create-contact-us-formpage-and-ajax.html
it will help you..
hello,
Replyplz provide me solution for error ScriptManager does not exist in current context
try to include System.Web.Extensions
Replyhi sir, i already applied everything u explained into this post but it doesn't work sending email point, please help me out doing this.
ReplyHello Mohammed Muthna..are you getting any error? if yes then send me the details of that error so that i can help you in solving that..:)
ReplyHello sir,
ReplyMy activation page is not working ??????
when i click on "click here to activate" this link. i redirect on ActivateAccount page
& i got this url (http://localhost/ActivateAccount.aspx?UserID=8&EmailId=jack@gmail.com)
but d whole page is blank.
please revert ASAP
Hello Aarti..i suggest you to try to debug the code on page load of ActivateAccount.aspx page..this way you can get the exact error..then let me know the results..i will help you to solve your problem..
ReplyThank's for u r reply.
Replyi debug ActivateAccount.aspx page but still it is blank.
there is no any error.
signup.aspx page link is:
string link = Server.HtmlEncode("http://localhost/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&email=" + emailId);
is it correct???????
Hello aarti..
Replythere must be a 4 digit port number attached with your url e.g. http://localhost:8665 in the link..
when you will run the registration or signup.aspx page then check the url from browser, it will contain 4 digit port number also. add the port number in the url also..
it should look like ActivationUrl = Server.HtmlEncode("http://localhost:8665/MySampleApplication/ActivateAccount.aspx?UserID=" + FetchUserId(emailId) + "&EmailId=" + emailId);
Goodmoring from Greece
ReplyThe article is great but when i run th app, i take this error
CS1502: The best overloaded method match for 'System.Data.SqlClient.SqlCommand.SqlCommand(string, System.Data.SqlClient.SqlConnection)' has some invalid arguments
Source Error:
Line 34: try
Line 35: {
Line 36: cmd=new SqlCommand("insert into Tb_Registration(Firstname,LastName,UserName,Password,EmailId,Phone,Address) values (@Firstname,@LastName,@UserName,@Password,@EmailId,@Phone,@Address)", con);
Line 37:
Line 38:
my email is kostasvit@gmail.com please help!!!!
Hello..i suggest you to recheck your table fields and their data types and ensure that you are passing the values to these parameters properly..if still you face the problem then let me know..i will help you in sorting your problem..
ReplyHellow Sir?I have deployed my application but dont want to hard code the url to send the email link to complete registration,how can i make sure it includes the current browser url i have than using my locallhost?
ReplyHi Sir Signup or Registration Page is Ok but
Replywhat about Login page and I trying this code for the login page without activating the link which come to my mail and now the login page is working without activating the link
Hello sir,
ReplyI tried to implement your code but somehow its not working.
It gives no error but when I click on the Submit button it redirect to the same page (Registration,aspx).
And the database is not updated also.
Please help me out.
Hello aarzoo patel..i suggest you to recheck your code thoroughly and try once again..if still you face the problem then let me know..i will help you to sort out the issue..
ReplyThe error was resolved.
ReplyThank you sir for this valuable code.
And keep posting new stuffs it really helps a lot.
Hi aarzoo patel..i am glad to know that you have resolved your issue..stay connected and keep reading..:)
ReplyGreat Work and good effort to ans every Visitor ASAP Like it Really
ReplyThanks Majeed Raju for your appreciations..
ReplyHello sir
Replyi went to put Google map of specific location in my site .
if you like to help me then pls help me.
Hi rajat kumar..i will create an article as per your requirement and publish very soon..so stay connected and keep reading ...:)
ReplySo It don't need do anything in
Replyprotected void Page_Load(object sender, EventArgs e)
{
} for this registration page?
Hi Sir Could you make sure I don't need add any code in th Page_Load event class?
ReplyYes , you don't need to write any code in page load event..
ReplyYes , you don't need to write any code in page load event..
ReplyThank you sir, I have a dropdown list in my table for user select different department. I code as:
Replycmd.Parameters.AddWithValue("@department",DropDownListDP.SelectedItem.ToString().Trim());
in the clear_Controls() code as: DropDownListDP.SelectedIndex = 0;
are they correct. Do I need add any in the ActiveAccount.aspx page.
I code as your way and run it , there are no any problem but no email, no data add to database, nothing happen. Could you tell me what's the problem. Thanks
Hi sir,If I want to create a registration compete page to show the successful message and error message. how can I do. If use entered same email address, how to validate and show message say: Your email address already be used.Thanks
ReplyCould you post your Reset Password code without using stored procedure database. I am doing a project don't want to use store procedure. This is an registration system. User register, receive email confirmation click the link in email to active account. Login, reset password if forget. Change password if received random given password. user can go their profile change their information. Logon.
ReplyCould help find code for all this steps without use stored procedure database. using very basic and easy way. thanks sir
Hello Lalit,
ReplyI'd appreciate your advice and if possible help in the following:
Is it possible to activate the account by calling a Web Service? I mean, the user receives the e-mail with the activation link, and the activation/approval process is made by calling a Web Service, instead of a Web Page to make the process seamless for the user.
I'd be very thankful for your help/guidelines because it's huge demand made in a project I'm involved in.
Thank you very much in advance
Paul
Hi, you can read the following article as per your requirement
Replyhttp://www.webcodeexpert.com/2013/04/how-to-return-data-through-output.html
how to send data like name,address,contact information on email address in asp.net
Replyhi, i have query regarding user registration whenever new user register have to generate user id and display in the label and using that id user have to login, so that next user should not have similar user id. also the previous registered user id should display automatically when next user login for new register.
Replythanks in advance
i m a big fan of urs lalit.. god bless.
Replykeep blogging..
Hi Reshav..thanks for appreciating my work...it is always nice to hear that someone liked my work..:)
Replygood one, but if I can download this.........
Replyv
Replyyes
ReplyIs it ok to use this code on my website
ReplyYes, of course you can with little or no modification as per your requirement..
ReplyHi, I want to registered an form in a database and have given an identifier for use later in my project, can you please help me
ReplyHi, I want to resgistred a form in a database and have given an identifier for use later in my project, can you please help me
Replysir i want to upload doc file in wef form..but doc file id download ..i want this file no download drct show the page a read ..please help me
ReplyHow to get user details by entering his id in the registration form automatically by pressing enter button
ReplyHello sir
Replygood job
only one problem will u plz help me to solve?
port number get chnaged so cant redirected sometime wts d solution
ActivationUrl = Server.HtmlEncode("http://localhost:62788/redsun/ActivateAccount.aspx?UserId=" + FetchUserId(emailId) + "&EmailId=" + emailId);
Dis port is changed evry time
When you make this page online you just need to replace the localhost path along with port number with your website name then it will work fine because the path will remain same always..
ReplyScriptManager Does not Exist"
Reply????
what is solution for this ?
Hello Bhavik,
Replythere may be two solutions to your problem. First include the namespace System.Web.UI
If still the problem remain the same then Go to solutions explorer -> right click on project -> Select add reference -> in .Net tab select System.Web.Extensions and click OK.
Please let me know it it resolved the issue or not?
in .net tab there is only System.web.Extensions .
Replyso now waht's the problem ??
Hi sir, is there any tutorial from you to create a complete website like way2sms? Needed for my project.
ReplyThank you.
Is System.web.Extensions checked? and have you included the namespace System.Web.UI ? I yes and still getting problem then send me the complete code , i will check and resolve your issue
ReplyHello Syed..Currently there is no such article as per your requirement. In future i will try to create that and post that here. so stay connected and keep reading..
ReplyMy coding is running successfully
ReplyHi, i got error at this line under private void activate account. can help me to solve the problem?
Replyif (!string.IsNullOrEmpty(Request.QueryString["CUsername"]))&(!string.IsNullOrEmpty(Request.QueryString["CEmail"])))
There must be && instead of single & in the code. Please correct that and it will work fine.
ReplyThanx Lalit , it was really use full for me :)
ReplySimple and very usefull. thank u sir |o|
ReplyUr welcome.Stay connected and keep reading for more useful updates like this..
ReplyUr welcome..I am glad you found this article helpful for you..:)
ReplyHow to get notification email..because i already submit the registration form and check the db table, the IS APPROVED is 0 need to check the email?but i dont get any email. please help
Reply#newbie
very great work....May God keep you always happy.and closet wish of your heart come true...Ameen
ReplyIf you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..