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
احمد صدقی
NA
106
16.4k
Is there any Method to create Login form without Session.
Mar 29 2019 1:36 AM
I am creating my Login form in my project as same from Session, but now in this project i want to create Login form without using any session. Anyone here to guide me? There is my Work using Session,This is Controller of LogIn:
public
class
LoginController : Controller
{
IMEI_WEB_MVC.Connections.IMEI_DBEntities imeidb =
new
Connections.IMEI_DBEntities();
Functions func =
new
Functions();
// GET: Login
public
ActionResult Index()
{
return
View();
}
[HttpGet]
public
ActionResult Autherize(log_variable logvariable_model)
{
log_variable lgv =
new
Models.log_variable();
string
pwd = func.security(logvariable_model.usr_pwd);
var userDetails = imeidb.new_usr.Where(x => x.usr_nam == logvariable_model.usr_nam && x.usr_pwd == pwd).FirstOrDefault();
if
(userDetails ==
null
)
{
logvariable_model.LogErrorMessage =
" Invalid Name or Password"
;
return
View(
"Index"
, logvariable_model);
}
else
{
Session[
"usr_id"
] = userDetails.usr_id;
Session[
"com_id"
] = logvariable_model.com_id;
Session[
"br_id"
] = logvariable_model.br_id;
//lgv.usr_id = userDetails.usr_id;
//lgv.com_id = logvariable_model.com_id;
//lgv.br_id = logvariable_model.br_id;
return
RedirectToAction(
"index"
,
"m_dpt"
);
This is my Model:
public
class
log_variable
{
[Required(ErrorMessage =
"User Name cannot be blank"
)]
[DisplayName(
"Name"
)]
public
string
usr_nam {
get
;
set
; }
[Required(ErrorMessage =
"Password cannot be Blank"
)]
[DataType(DataType.Password)] [DisplayName(
"Password"
)]
public
string
usr_pwd {
get
;
set
; }
public
int
usr_id {
get
;
set
; }
[Required(ErrorMessage =
"Company ID cannot be blank"
)]
[MaxLength(2)] [DisplayName(
"Company_ID"
)]
public
string
com_id {
get
;
set
; }
[Required(ErrorMessage =
"Branch ID cannot be blank"
)]
[MaxLength(3)]
[DisplayName(
"BRANCH_ID"
)]
public
string
br_id {
get
;
set
; }
public
string
LogErrorMessage {
get
;
set
; } }
Reply
Answers (
1
)
how upload asp.net project into a server
Problem in connection string