Hi Friends!Today, i am going to make a Custom Registration and Login Page.This is not a simple web form page.In this Form i have used many concepts.You can easily implement this concept to any where in .NET Application. In this application i have covered all things which is required in various Registration and Login Form in any website.I am really saying to you,if you run this application on your computer then you will feel how much good it is.You can download this application from bottom and run on your visual studio.There are some controls which i have used in this application.
Make this Registration Form in following ways:- Script Manager(Ajax)
- UpdatePannel(Ajax)
- RequiredFieldValidator
- RegularExpressionValidator
- Captcha Image
- Session
- Text Box
- Label and Button
There are some steps to make this application.Please follow this.
- First put ScriptManager on your form.
- Create UserName-->Now put UpdatePanel-->Now put TextBox in UpdatePanel->Put RequiredFieldValidator.
- Password--> TextBox-->Now put RequiredFieldValidator.
- Retype Password-->TextBox-->Now put RequiredFieldValidator.
- Mobile Number-->TextBox-->Put RegularExpressionValidator & RequiredFieldValidator
- Email Id -->TextBox-->Put RegularExpressionValidator and RequiredFieldValidator.
- Captcha Image-->To know more here
- Enter Captcha Image-->TextBox-->Put Label and RequiredFieldValidator.
Now go propeties in every RegularExpressionValidator & RequiredFieldValidator and set following fields which is given below:
Control To Validate -->Select TextBox which you want to validate. open this application on your visual studio and see all changes.This is more easy for you.
Step 3: Now Add Database(.mdf) on your website.Open Solution Explorer -->Right click on website-->Add New Item-->Sql Server Database-->click Add.
Now if you are facing problem in adding database(.mdf) on Website,please here.
Step 4: Now Double click on Database.mdf --> Solution Exporer will open-->Right click on Tables -->Add New Table-->Now Enter the column name.
see it:
Step 3: Now Add Database(.mdf) on your website.Open Solution Explorer -->Right click on website-->Add New Item-->Sql Server Database-->click Add.
Now if you are facing problem in adding database(.mdf) on Website,please here.
Step 4: Now Double click on Database.mdf --> Solution Exporer will open-->Right click on Tables -->Add New Table-->Now Enter the column name.
see it:
Step 5: Now double click on Submit Button and write the following code which is given below:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
con.Open();
SqlCommand cmd = new SqlCommand("select*from regform where username='" + TextBox1.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Label1.Text = "User Name is Already Exist";
this.Label1.ForeColor = Color.Red;
}
else
{
Label1.Text = "UserName is Available";
this.Label1.ForeColor = Color.Red;
}
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
captcha1.ValidateCaptcha(TextBox6.Text.Trim());
if (captcha1.UserValidated)
{ //you can use disconnected architecture also,here i have used connected architecture.
SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
con.Open();
SqlCommand cmd = new SqlCommand("insert into regform values(@a,@b,@c,@d)",con);
cmd.Parameters.AddWithValue("a", TextBox1.Text);
cmd.Parameters.AddWithValue("b", TextBox2.Text);
cmd.Parameters.AddWithValue("c", TextBox4.Text);
cmd.Parameters.AddWithValue("d", TextBox5.Text);
cmd.ExecuteNonQuery();
Session["name"] = TextBox1.Text;
Response.Redirect("default.aspx");
con.Close();
}
else
{
Label2.ForeColor = System.Drawing.Color.Red;
Label2.Text = "You have Entered InValid Captcha Characters please Enter again";
}
}
}
Step 6: Now create a New page and make a Login form which is give below:
see it:
Note->In this application all (* )represents the Label control.
Step 7: Now Double click on Login Button and write the following codes which is given below:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
public partial class login : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
con.Open();
SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
cmd.Connection = con;
int OBJ = Convert.ToInt32(cmd.ExecuteScalar());
if (OBJ > 0)
{
Session["name"] = TextBox1.Text;
Response.Redirect("default.aspx");
}
else
{
Label1.Text = "Invalid username or password";
this.Label1.ForeColor = Color.Red;
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect("Registration.aspx");
}
}
Step 8: Now Create a another page (Default.aspx)which is given below:
see it:
Step 9: Now Double click on Page and write the following codes on Page load which is given below:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Session["name"].ToString();
}
}
see it:
There are some points to see the Exact output of whole application.
1. If you are not part of this application then click New User Button.
see it:
2. When you will Enter UserName then this user name will check from database.if this name is available then it will show User Name is available otherwise show User Name is Already Exist.
see it:
3. when you will Enter Password & ReType Password Field ,if both Password are not matched then see it:
4. when you will Enter Mobile Number Field ,if Number is Not correct (according to India).you will see following output:
5. If you will Enter Email Id Field and Email is not correct format then you will see following error.
6.when you will enter wrong Captcha code then you will see following output:
7. When you will enter all fields in Registration page correct then you will see following output:
Step 11: Now you will see Rajesh has entered Database(.mdf).
see student table:
Step 12: Now you can directly Login with correct Login Name and Password,which is present in Database(.mdf).
see it:
see output:-
Step 13 : You can add Change Password page in this page from here
Step 14 : You can add Forget password codes in this page from here
Step 15 : You can add send email service in this page from here
Step 16 : You can build 3 Tier Registration and Login page from here.
Step 17 : You can create existing asp.net registration and login page esaily from here.
Step 18 : You can use cookie concepts in this page from here.
Step 19 : You can use caching concepts in this page from here.
Step 20 : You can create secure registration and login page with hashing in asp.net here.
Note- If you want to run this application on your system directly, without any changes then follow first two steps(1 to 2) and other four steps(3 to 6),you can add extra features in your application which are given below:
- First download this application form bottom and open this application to your visual studio 2010.
- Now go Tools -->Options -->Database Tools -->Data connections -->Remove Sql Server Instance Name(blank for default) from right hand side-->click OK.
- If you want ,you can implement Form Based authentication in this form for security purpose.
- You can use different connection strings for your registration and loin page also from here. Such as store procedure,connected architecture,disconnected architecture parameterized connection etc.It will provide full security to your asp.net application.
- This registration page is full secure,i have putted security codes also.
For More:-
- How to build Real Form Filling Application like IBPS
- Learn More .NET Interview Questions and Answers for Job seekers
- Create a Setup File
- Take Print receipt in Windows Form Application
- File Handling Real Application
- E-Post System Project
- Overview of C#
- Call by value and call by reference
- How to implement all Web Form controls in asp.net
- Data List Real Application
- Repeater control Real application
- How to use session in asp.net application
- How to use Navigation control in asp.net
- How to implement web services in asp.net application
- How to use WCF Services in asp.net application.
- Create captcha image without dll file in asp.net
- How to create setup file with database
- How to Create photo gallery of your friends like facebook and google+
- How to build Your own window media player easily
- How to host your WCF services on your local computer and use it from other computers also
- How to use secure login page in asp.net with example
- How to Add and verify Captcha image in 3 tier architecture in asp.net
- How to use virtual keyboard in asp.net for security purpose
- How to implement hashing concepts in asp.net
- Learn complete .Net Interview Questions and answers for job seekers
I hope this helpful for you.
Please share this page if this is helpful for you.
Please share this page if this is helpful for you.
Download Whole Attached file
hi...
ReplyDeletereally good article but can u tell me i want to place another button and change/refresh image on click how to do it???
thnx in advance
Hi...this very good articles that is use full fore me and others thanks but I need more things fore you so how to add ore pages and how to re direct it?
Delete@Vivek sharma
ReplyDeletebro.. use AdRotator control on page.visit:
http://www.msdotnet.co.in/2013/07/web-forms-controls-in-aspnetii.html
I agree With U Dear
Deleteforget link code is not avail
ReplyDelete@Akash Raina I have checked ,it is working........
ReplyDeleteTry again.....
https://www.youtube.com/watch?v=APOaDZYQ6Bw
Deletethank you very much Ramashanker Verma this has really helped me for my final project as i am preparing the registration web
ReplyDeleteosum dear..really gud one..
ReplyDeletewhat about forgot password code ?
ReplyDeletei will explain it in separate tutorial........wait
Deletewhenever i click on submit or login button i am shown this
ReplyDeletecan u please help?
Server Error in '/WebSite4' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 15: {
Line 16: SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
Line 17: con.Open();
Line 18: SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
Line 19: cmd.Connection = con;
@Raer ,your visual studio connection setttings and sql server instance may not same.please follow this tutorials from start to end and implement it on your sql server and visual studio as shown in tutorial. you will definitely solve your problem. visit:-
Deletehttp://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html
the problem is in con.open()
ReplyDeleteAlso when i try to view default.aspx in browser it show this
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 8: protected void Page_Load(object sender, EventArgs e)
Line 9: {
Line 10: Label1.Text = Session["name"].ToString();
Line 11: }
Line 12: }
Source File: c:\Users\jc\Documents\Visual Studio 2010\WebSites\WebSite4\Default.aspx.cs Line: 10
with the problem being in the label1.text line
Pls help
@Raer, first store the session value in session object on first page as
Deletesession["name"]=TextBox1.Text; after that show the session value on the second page as Label1.Text = Session["name"].ToString(); .You can not open the second page as a startup page first.it will give error.so make "set as startup page" first web form .
more knowledge about session visit:
http://www.msdotnet.co.in/2013/10/how-to-use-session-state-in-aspnet.html
Amazing and useful one ... i really support u and i will refer the students
Deletei want login with smaleest vaue in database
Deletefor supose
ser value
1 15
2 12
3 10
i want login smalll value in vaue colum
SEND CODING IN MY ID ............gautammaharaj1@gmail.com
Deleteplz help me out m getting this kind of error
ReplyDeleteUnable to open the physical file "C:\Users\PRIYANKA\Documents\Visual Studio 2010\WebSites\LOGIN AND USER REGISTRATION FORM\App_Data\Database.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file C:\Users\PRIYANKA\Documents\Visual Studio 2010\WebSites\LOGIN AND USER REGISTRATION
hello priyanka copy all code for your login and regestration form and new site create in paste code and check the your error...oterwise set the path of storage file......
DeleteHow to create a web services?
ReplyDelete1.open a empty website
Delete2.add new item
3.select web service
4.than write down
[webmethod]
public int add(int x + int y)
{
return(x+y);
}
5.than run ..........
same as multiply and sub....
Its really help full thanks bro.........
ReplyDelete@priya Jadhav sorry for late reply.This error is coming due not open Database.mdf file.To solve this problem see this post:-http://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html
ReplyDelete@Sushma Rani i will discuss this our coming tutorials wait.........
ReplyDeletegive me code for forgot page plz.i really need it...........
ReplyDeletevisit:- http://www.msdotnet.co.in/2013/11/how-to-send-forget-password-is-aspnet.html
DeleteHI, select count (*) from Table_name command is always fetch the record and redirect to the specified page.
ReplyDeleteif you want to stay same page then delete below code
DeleteResponse.Redirect("default.aspx");
in login page it shows below type of error..
ReplyDeletethis is code
int OBJ = Convert.ToInt32(cmd.ExecuteScalar());
error is : Input string was not in a correct format.
Hi Dear Friend.
ReplyDeleteI would like to make customized outlook web access page.
But I don't. So please help me.
i m facing this problem plz help me
ReplyDeleteThe system cannot find the file specified
Line 19: SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
Line 20: con.Open();
Line 21: SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
Line 22: cmd.Connection = con;
you are facing connection problem.read below link;-
ReplyDeletehttp://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html
mind bloing..............
ReplyDeleteawasaaaaaaaammmmmmmmmmmmm
how the registration page more attractive?that is stylish textboxes,button etc.
ReplyDeleteHI HOW TO UPLOAD An photo and display in same from n in database
ReplyDeletei have download ur project and try to open there no file with extension .slm. but i have open each file one after the other and when i ty to run it is showing me to attachment some what is that ?
ReplyDeleteyes i am new to asp.net and want to learn from you please help me..............
Hi Mr. Ramashanker Verma
ReplyDeleteThis work is so very helpful.
How can I verify my registration using the email id i used for registration.. .do you have a code for it (email verification) ? Thank you for the help.
do you also able to generate auto suggest username like in registation yahoo.com .. may you help me pls. thank you i need my school project
ReplyDeletehello sir,
ReplyDeletehow are you?
how to add profile image in profile and how to set http address like in facebook.com and facebook.com/zakee.malik.. please help me
hello sir , i have completed all coding and design for registration form , but its does not work , its application run , does not redirect to another page and user details like user name, mob num, email id did not insert into table. i dont know what is my mistake ,
ReplyDeletei want to implement my project ,,,,, i need ur comment..
hi kalpana,what error is showing,when you click button,then i can tell you what is actual problem in your application.........
Deletewhen i click submit btn , does nt show any error ,its simply on same page olny.. data did nt insert into table and did nt direct
DeleteHi plz help me.. I want to create login page where i enter a name as username then login... when I enter a login then it can display me a homepage... and in homepage there will b another button logout... plz tell me the code.... as soon as possible(using session)
ReplyDeletesorry for late reply,i have not seen you comment.
Deletesession["variable_name1"]=null;
session["variable_name2"]=null;
response.redirect("home.aspx");
Or
session.removeall();
response.redirect("home.aspx");
hi i followed all proceduer as you gave in add capcha image but i got Error like "The type or namespace name 'MSCaptcha' could not be found in the global namespace (are you missing an assembly reference?)".So please can you give mi solution on this?
ReplyDeleteHi kalpana ,your handler is not working correctly.first download the application -->open your visual studio 2010-->only change connection strings otherwise read http://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html
ReplyDeletethis then you will not have to change connection strings.
thanx a lot finaly i got d o/p ....
Deletethanx a lot finally got d output
DeleteHi..Sir.
ReplyDeletePlease tell me that how to use filter for data searching without database. Actually i have to call API.
hello sir,
ReplyDeletei've followed all the code you posted
but i got some problem on the checking of the username
it doesn't show any error in checking the username but the label doesn't automatically show the text which notify that the username is available. I've put the textbox in the update panel though
can u give me some advice? thx
hi Alvin , go properties set AutoPostBack = True.then will work .........
Deletethank you so much.......................
ReplyDeleteHow to use ms access database in this program????
ReplyDeleteY don't u reply n my comment???
ReplyDeletehi Rumaisa see it,in your first comment......
DeleteI want to connect my login page to Sql database ...How can i do that ?and more how can i know if i enter some values in login page or registration page can we know whether it is storing in our database or not? how can we know that/ will u please explain me
ReplyDeletehi shalini !
Delete1.) in above post i have used Database.mdf file for login. you can login with sql database or other database by providing connection strings.i have mentioned different connection strings with database,you can see from below link.
http://www.msdotnet.co.in/2013/12/how-to-use-different-connection-strings.html
2.) If you want check whether data is inserted in database or not .open solution explorer-->open Database.mdf file --> Tables--> right click on your tables name ---> Show Table Data.you can see data is inserted or not.other things if data is not inserted in table then it will give error.
3.) if want to attached Database.mdf or .sdf file in your sql server then read below links.
http://www.msdotnet.co.in/2014/03/how-to-attached-mdf-or-sdf-file-in-sql.html
first read above links carefully ,if any other problem ask frequently......
hello.what is the use of update panel and script manager??????
ReplyDeleteRead below link:
Deletehttp://www.msdotnet.co.in/search/label/Ajax
thanks dude.............
Deletei am getting error.please help
ReplyDeletethe page says: Server Error '/' Application
Webforms UnobstructiveValidationMode requires a ScriptResourseMapping For 'jquery'.Please add a ScriptResourseMapping names jquery(case-sensitive).
Hi sir i run that program successfully but when i enter the detail on registration page then the database connection error will show the visual studio open and cursor on open con and that error come on the mobile entry
ReplyDeleteGo step 5-->check Text Box change connection string codes-->this connection strings are showing errors-->correct it then it will work....
DeleteHi sir i successfully run that registration page but when i entry n registration page so the database error come when i entry in the mobile no text box that time visual studio show the cursor on con.Open(); command so please help me how i resolve that problem
ReplyDeletehi Vikash, your connection string are not working properly.first correct it by reading the above tutorials carefully.
Deletecan we give primary key with identity??
ReplyDeletehi komal ! Yes ,you can set a primary key in your database column...
ReplyDeleteHi Verma,
ReplyDeleteI want to create a registration page with first name,last name,cellphone number and prefered contact whould be email or text.
Please help me in the coding.
If user click the SUBMIT BUTTON.
The details should store in sql.
Please help me .
Thank you,
Sowjanya.
hi sowjanya ! In above tutorial ,you can store all values in sql database by click submit button..Here i have used .mdf database which is a part of sql database.you can store your values in separated database also if you want. you can follow below link for connection string in separate sql database .
Deletehttp://www.msdotnet.co.in/2013/12/how-to-use-different-connection-strings.html
in login page i give the link button to change a password... so what is the code for change password in asp.net.. using C#
ReplyDeleteHi Varunda !
ReplyDeleteApply this concepts:-
1 ) first fetch password value from you sql table.
2.) If password is present in database then update new password value on that column (password) by sql command.
i will add this concepts in this login page as soon as possible.
ok thanks
ReplyDeletei have also problem in to create a login page with different user admin & other user. and i want to give few right to user & admin so how can i do .
ReplyDeletehI Vrunda ! use form based authentication for this. You can specify each admin name and password in this section.i have mentioned this link on this form.
ReplyDeleteplz give me link of the below question...
Deleteread below link:-
Deletehttp://www.msdotnet.co.in/2014/02/how-to-implement-form-based.html
thanks for replay
ReplyDeletehello sir, i have one more to create crystal report in asp.net ...so i want to send my form & table for explanation so how can it possibal..?
ReplyDeletei have not written any post on crystal report.i will post soon.so please refer it from other places.....
DeleteHello... I want to attach database in SQL server management.. When I click on databases then right click --> Attach --> Add --> choose file --> Then OK....... I got the error msg " attach database failed for server 'RUMAISAKHAN-PC'. (Microsoft.sqlServer.Smo)..... what I will do now...... Please reply ASAP..
ReplyDeletePlease please reply fast.
ReplyDeletehi Rumaisa ! first open your sql server in Administrative mode.Read below links for this:-
Deletehttp://www.msdotnet.co.in/2014/03/how-to-attached-mdf-or-sdf-file-in-sql.html
helo sir,,,,,,,,
ReplyDeletecan you help me in mvc????
to create login page with sql sever
Hi Verma,
ReplyDeletei have already created a login n registration page....nw i wanted to create a Administrator page so that Admin can be able to change the roles of the users ...without using the roles management... can u plz help me out sir ...
hi nandini ! you have to create custom roles in web.config file.Read below post and follow step 3 .It will help you definitely.......
Deletehttp://www.codeproject.com/Articles/22503/Custom-Membership-Role-Providers-Website-administr
hi, its good. I want to send E-mail by using my asp page, please help me.
ReplyDeletehi Admin ! Read Step 15 here link.it wil be helpful to send email service in asp.net application
DeleteHello Sir,
ReplyDeleteI am creating an online examination website which is to be hosted on web.Is it necessary to use post/get methods to store data in database???
Hi shah ! Without get or post method how can you add data in your database.Yes ,it is necessary to submit data from one place to another place in HTML.
ReplyDeleteRead below link for more information about get and post methods:-
http://www.w3schools.com/aspnet/aspnet_forms.asp
can't it be done through coding in c#??
DeleteHi Sir ,
ReplyDeleteI didn't type any value in the TextBox1 yet my label message or label1 Status is already shown, why is that so ? please help me.
Hi MICHELE , What message is showing in your label control.if want to hide your Label control on the page then go properties of Your label control --> Set Text = * if you remove all text of label control then label1 message will be shown on your page.So don't leave blank of your Label Text properties.If any other problem then specify it..
DeleteIs it possible to add roles for login pages? if yes , how to do it? which means after the user have entered the correct username and password , if the user is admin , they will be redirected to admin pages .. If the user is a teacher , they redirected to teacher pages ?please help me.. its for my school project >.<
ReplyDeleteyes.... you can use simple method.Use a dropdownlist in you login page with three fields student,teacher,administrator. use if and else conditions and solve your problems.it is very simple method.
DeleteThanks ^^ i fixed the role :D
DeleteIt is still showing the label message like "User ID is available" but i didn't type anything in user id textbox. I have set the text = * for label control. Please help me...
ReplyDeleteprotected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MajorProjectConnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("select*from [user] where userid='" + TextBox1.Text + "'", conn);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Label2.Text = "User ID is Already Exist";
}
else
{
Label2.Text = "User ID is Available";
}
conn.Close();
hi ANN, Your database contains a blank entry that's why this message is showing.Remove blank entry in your database then it will be solved......
DeleteThis comment has been removed by the author.
DeleteVery easy to understand, thanks for teaching us dude!
ReplyDeleteIts working thx :)
ReplyDeleteA network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
ReplyDeleteThis is what i get when i run my code That too this exception occurs in con.Open();
Help me with this as soon as possible
Thanks and itz working fine for me!!
ReplyDeleteHi.. The ExecuteScalar() method is checking only the 1st row..
ReplyDeleteIn debugging mode.. Value of obj=1 for 1st entry in the DB.. For rest of the entries obj=0... How to overcome this problem..
Thanks.
Hi Sir when I run this program iam getting Error
ReplyDelete"The user instance login flag is not supported on this version of SQL Server. The connection will be closed
please tell me how to fix this error
hi Rupesh,
DeleteRead below forum for this error.
http://forums.asp.net/t/913172.aspx?Error+Message+The+user+instance+login+flag+is+not+supported+on+this+version+of+SQL+Server+The+connection+will+be+closed
Hi
ReplyDeleteVery nice example one thing is I confused that What is use of scriptmanger and updatepanel here so please explain it
Read below post,,,,
ReplyDeletehttp://www.msdotnet.co.in/search/label/Ajax
whenever i click on submit or login button i am shown this
ReplyDeletecan u please help?
Server Error in '/WebSite4' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 15: {
Line 16: SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
Line 17: con.Open();
Line 18: SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
Line 19: cmd.Connection = con;
Check your Data Source Name in sql server...
Deletevisit below link to solve this problem..
http://www.msdotnet.co.in/2013/04/how-to-solve-problem-to-add-sql.html
sir can u please help me how to create job application in asp.net using c# and the fileupload,qualification must be master and they should be in dropdown fileds must be manidatory can u please uplaaod this video
Deletehello ,Ramsankar verma will it work in visualst
ReplyDeleteudio2013.i m facing error ...
Thank you sir, this is very helpful for me
ReplyDeleteI want to know more about asp.net from you, But how can it possible ?
Hi Nawaraj, Read every post on this website and implement each post on your visual studio.if any problem you can ask me.....i will helpful...
Deletehi sir, my name is hailemariam, i live in Ethiopia. I wanna to create sign language using C# language. so, can you help me a simple code to create sign language? please hep me!
DeleteHello sir, I was going through your article... Its great but I just wanted to know how to display some content only for logged in users and how to avoid the non-users from watching it... Thanks and regards.
ReplyDeleteWhere I can download the whole code
ReplyDeleteHi...can u help me to solve this error
ReplyDeletei created two pages frm_category and frm_investment ,in which frm_category has category,name and address and frm_investment contains date,category,name,investment,previous balance and net amount
i did coding for frm_category and is executed but in frm_investment a syntax error occured that i couldnt correct
please help me to solve this.
if I run this ,a "category" is selected corresponding name should shown in drop down list of "name" .Upto this is done well
I need your help for the following things:
1.the selected category member's name is shown and the previous balance should be displayed in the textbox as "0"
2. If i add investment as "200" then net amount is displayed as 200 (previous balance+investment)
3.again i run the frm_investment i select another date, and select the same category and corresponding name which i selected in step 1 then the previous balance should be displayed as "200".
4. Again i add investment "300" the net amount now is 500
here is the code of frm_investment done by me
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class frmInvestment : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=category;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from tbl_category",con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
DrpCategory.Items.Add(dr["category"].ToString());
}
dr.Close();
con.Close();
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into tbl_investment values ('"+txtDate.Text+"','"+ DrpCategory.Text +"','"+DrpName.Text+"','"+txtInv.Text+"','"+txtPrev.Text+"','"+txtNet.Text+"')", con);
cmd.ExecuteNonQuery();
con.Close();
}
protected void DrpCategory_SelectedIndexChanged(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from tbl_category where category='" + DrpCategory.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
DrpName.Items.Clear();
DrpName.Items.Add("select");
if (dr.Read())
{
DrpName.Items.Add (dr["name"].ToString());
}
dr.Close();
con.Close();
}
protected void DrpName_SelectedIndexChanged(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from tbl_investment where name='" + DrpName.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
do
{
txtPrev.Text = dr["Net amount"].ToString();
}
while (dr.Read());
{
}
txtPrev.Text = "0";
dr.Close();
con.Close();
}
protected void txtInv_TextChanged(object sender, EventArgs e)
{
txtNet.Text=Convert.ToString(Convert.ToInt32(txtPrev.Text)+Convert.ToInt32(txtInv.Text));
}
}
Hi Mohsina m,
DeleteYour variables are taking garbage value,So you have to initialize every variable like txtPrev.Text=null and txtInv.Text=null, if you are doing large project,so you have to initialize every variable either null or 0, if it is taking string put it null at declaration time, if it is taking integer put it 0 at declaration time. I hope this is helpful to solve your problem,if any other problem ask again...
Hi..I am new to ASP.net and I followed your login and registration, facing the below error. Please help me.
ReplyDeleteDescription: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: 'projectregister.default' is not allowed here because it does not extend class 'System.Web.UI.Page'.
How to encrypt the password of the user?
ReplyDeleteYou should not encrypt password. Always do hashing for password.
DeleteHere is code to hash password.
public static byte[] HashPassword(string password)
{
var provider = new SHA1CryptoServiceProvider();
var encoding = new UnicodeEncoding();
return provider.ComputeHash(encoding.GetBytes(password));
}
good thank you . how I can doing the same login with c# windows application , please
ReplyDeletevery good thank you . please I need the same login in c# windows application
ReplyDeleteThanks for sharing this Mr. Ramashankar I am using bulk sms asp.net api for bulk sms.Is it good to send bulk sms?
ReplyDeleteThanks for sharing this valuable content
ReplyDeleteRegards
Bulk SMS PLANS
Many thanks for sharing such incredible knowledge. It's really good for your Website.
ReplyDeleteThe info on your website inspires me greatly. This website I'm bookmarked. Maintain it and thanks again.
I'm really impressed with your writing skills, as smart as the structure of your weblog.
Output Portal Crack