TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Baybars Bay
1.7k
88
3.7k
Saving asp.net encrypted password to sql database
Nov 28 2020 11:22 AM
.
I want to save the password in the asp.net user registration form in an encrypted format to the sql database.
I'm waiting for your help
public ActionResult InsertDetails()
{
return View();
}
// Calling on http post (on Submit)
[HttpPost]
public ActionResult InsertDetails(Register obj)
{
Register objreg = new Register();
string result = objreg.InsertRegDetails(obj);
ViewData["result"] = result;
ModelState.Clear();
return RedirectToAction("Index", "Photos");
}
-----My model-----
public class Register
{
public int User_ID { get; set; }
public string UserPicturePath { get; set; }
public string E_Mail { get; set; }
public string User_Name { get; set; }
public string Password { get; set; }
public Nullable<System.DateTime> DateBirth { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string MentionAbout { get; set; }
public Nullable<System.DateTime> CreationDate { get; set; }
SqlConnection con = new SqlConnection("Server=.;Database=IMAGESBILBOARD;Trusted_Connection=True;");
SqlCommand cmd = new SqlCommand();
public string InsertRegDetails(Register obj)
{
cmd.CommandText = "Insert into [UsersInfo] values('" + obj.UserPicturePath + "','" + obj.E_Mail + "','" + obj.User_Name + "','" + obj.Password + "','" + obj.DateBirth + "','" + obj.Country + "','" + obj.City + "','" + obj.MentionAbout + "','" + obj.CreationDate + "')";
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
return "Success";
}
catch (Exception es)
{
throw es;
}
}
}
Reply
Answers (
1
)
Asp.net mvc core multiple Navbar radio button
Problem uploading files via asp.net core api