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
Karan Thakkar
1.5k
204
90.1k
Asp.net core method doesn't executes for second request?
Aug 17 2019 7:25 AM
I am using ASP.NET Core Web API and authenticating user with LDAP server within API. I am using the third party directory which Novell Directory. Everything is working as expected. The problem occurs when I send the request to API for the second time that is after logout again login method doesn't execute in API it directly skips and moves towards next statement but if debug the and press F11 on that statement method works fine, but not with F10 or F% or without debugging.
[AllowAnonymous]
[HttpPost]
[Route(
"login"
)]
public
IActionResult Login([FromBody] User user)
{
string
errorMsg =
string
.Empty;
{
LdapAuthenticationFacade ldap =
new
LdapAuthenticationFacade();
errorMsg = ldap.AuthenticateUser(user.LoginId, user.Password, user.ClientIp);
if
(
string
.IsNullOrEmpty(errorMsg))
{
return
Ok();
}
}
errorMsg =
"Invalid Login ID or Password!"
;
return
BadRequest(errorMsg);
}
public
string
AuthenticateUser(
string
loginId,
string
password,
string
clientIp)
{
string
errorMsg =
string
.Empty;
dynamic result = GetConnection(loginId);
try
{
if
(result.Count > 0)
{
var user = result.next();
if
(user !=
null
)
{
_connection.Bind(user.DN, password);
if
(_connection.Bound)
{
return
errorMsg;
}
}
}
}
catch
(LdapException ex)
{
errorMsg = ex.LdapErrorMessage;
}
_connection.Disconnect();
return
errorMsg;
}
Reply
Answers (
1
)
Facing an error while i'm get record
Help me to develop the project.