Your question has been submitted and is awaiting moderation.
Thank you for reporting this content, moderators have been notified of your submission.
I'm trying to log a user into a dnn site from a third party application. The idea is, they login to my custom app, I check that username and password against what DNN has (already have that working) and then I log them into both my site and the dnn site.
I have a web service set up right now that does log the user in if you browse to it. Like mydnnsite.com/myservice/login?un=user&pw=password
However, if I just call that as a web request from my third party site, it does not log the user in. I'm assuming it's because a cookie isn't getting set when I don't actually browse to the site. Any ideas on how I can accomplish this? Here is my login web service script as of right now
//create the status object
DotNetNuke.Security.Membership.UserLoginStatus status = new DotNetNuke.Security.Membership.UserLoginStatus();
//set it to fail
status = UserLoginStatus.LOGIN_FAILURE;
//see if they are a valid user
var obj = UserController.ValidateUser(0, username, password, "DNN", PortalSettings.PortalName, hostIp, ref status);
if (status == UserLoginStatus.LOGIN_SUCCESS || status == UserLoginStatus.LOGIN_SUPERUSER)
{
//if they are, log them in and return true
UserController.UserLogin(0, obj, PortalSettings.PortalName, hostIp, false);
DotNetNuke.Services.Authentication.UserAuthenticatedEventArgs eventArgs = new DotNetNuke.Services.Authentication.UserAuthenticatedEventArgs(obj, username, status, "DNN");
eventArgs.Authenticated = true;
System.Web.Security.FormsAuthentication.SetAuthCookie(username, true);
return "true";
}
else
{
return "false";
}