I am building a custom login module to redirect the user to different pages based on the "type" of user. Users may be in certain roles or not a DNN user at all.
I write a cookie to be read by a module on the target page denoting the type of user along with some other info.
If the user is a non DNN user the cookie is written as expected.
If the user is a DNN user, and logged in successfully, the cookie fails to write. Checking the Network tab in FF, the cookie is not in the response header.
Login is done with:
var loginStatus = UserLoginStatus.LOGIN_FAILURE; UserController.UserLogin(portalid, username, password, "", "", ipAddress, ref loginStatus, false); If I comment out UserController.UserLogin(... and return Login.SUCCESS, the cookie is written successfully. Checking the Network tab in FF, the cookie is in the response header.
The response header is created using:
HttpResponseMessage respMessage = new HttpResponseMessage();
respMessage.Content = new ObjectContent(retVal, new JsonMediaTypeFormatter()); Logger.Debug("=== Add Cookie ======================================================"); respMessage.Headers.AddCookies(new CookieHeaderValue[] { BuildCookie(cookiedata) });
Logger.Debug("=== End Validate User =================================================");
return respMessage;
Why does successful login in of a DNN user stop the cookie been written? Is there something else I need to do? Should I pass data between pages in some other way? Is IMC (Inter Module Communication) still a thing? In this instance IMC is not an option, for now, as the module on the target pages expects a cookie.
Declan
EDIT: As far as I recall, IMC is for modules on the same page.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.