cookiesumbracop3p

logging in to umbraco 6.1 backend doesn't work anymore, keep getting errors and redirect back to login.aspx page


after nog using the backend of our umbraco website for a few months I started developing for our website again. As the website was being used by some people, I decided to use a staging environment. So I moved all my files and finally got the database also cloned.

But now whenever I try to login to the backend of umbraco (in the live and the staging environment) I get a javascript error in my firebug console:

{"Message":"The user has no umbraco contextid - try logging in","StackTrace":"   at Umbraco.Web.Security.WebSecurity.ValidateCurrentUser(HttpContextBase httpContext, Boolean throwExceptions)\r\n   at Umbraco.Web.Security.WebSecurity.AuthorizeRequest(HttpContextBase httpContext, Boolean throwExceptions)\r\n   at Umbraco.Web.WebServices.UmbracoAuthorizedWebService.AuthorizeRequest(Boolean throwExceptions)\r\n   at Umbraco.Web.WebServices.UmbracoAuthorizedWebService.AuthorizeRequest(String app, Boolean throwExceptions)\r\n   at umbraco.presentation.webservices.TreeClientService.GetInitAppTreeData(String app, String treeType, Boolean showContextMenu, Boolean isDialog, TreeDialogModes dialogMode, String functionToCall, String nodeKey)","ExceptionType":"System.InvalidOperationException"}

As suggested in other posts, I delete my cookies and try again, but no luck.

I also get some other errors from time to time:

uiKeys is undefined

I uploaded my umbraco/config/lang folder using Binary, but I still get the error sometimes

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

I added this to my web.config

<pages enableEventValidation="false" validateRequest="false" viewStateEncryptionMode ="Never" />

and the error seems gone

I also got some error about synthax in the document type declaration at the start of the logout page which I get redirected to

I have been at this for several hours and can't seem to fix it.

Locally loggin in works.


Edit

I just did a fresh install of 6.1.6 and 6.1.5 and tried to logon but I still get the error: http://staging.mydomaimn.com/umbraco/webservices/TreeClientService.asmx/GetInitAppTreeData 500 Internal server error: {"Message":"The user has no umbraco contextid - try logging in","StackTrace":" at Umbraco.Web.Security.WebSecurity.ValidateCurrentUser(HttpContextBase httpContext, Boolean throwExceptions)\r\n at Umbraco.Web.Security.WebSecurity.AuthorizeRequest(HttpContextBase httpContext, Boolean throwExceptions)\r\n at Umbraco.Web.WebServices.UmbracoAuthorizedWebService.AuthorizeRequest(Boolean throwExceptions)\r\n at Umbraco.Web.WebServices.UmbracoAuthorizedWebService.AuthorizeRequest(String app, Boolean throwExceptions)\r\n at umbraco.presentation.webservices.TreeClientService.GetInitAppTreeData(String app, String treeType, Boolean showContextMenu, Boolean isDialog, TreeDialogModes dialogMode, String functionToCall, String nodeKey)","ExceptionType":"System.InvalidOperationException"}

This is on a fresh install that never had logins before Perhaps the problem is with the database setup. My host uses MSSQL 2012 and I have two databases, the first is for the live version which is called 'myloginname' and the second is for the staging which is called 'myloginname_1'. is the _1 a problem when placing the logon in the database (which I read Umbraco does)?


Edit 2

just looked in my database and Umbraco does create a contextId in the db table 'umbracoUserLogins' but does not create the cookie which should contain the same 'UMB_UCONTEXT'

so this is probably my real problem, what could be causing this?

Edit: some more info on this: When I look in Fiddler I can see this: On the 'Raw' tab:

HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=utf-8 Location: /umbraco/ Set-Cookie: ASP.NET_SessionId=zjlqfoxq421wmnpeydcbxv1t; path=/; HttpOnly Set-Cookie: ASP.NET_SessionId=zjlqfoxq421wmnpeydcbxv1t; path=/; HttpOnly Set-Cookie: UMB_UCONTEXT=694C3[...a lot of text...]CFDD5EDB; expires=Tue, 12-Nov-2013 14:07:23 GMT; path=/; HttpOnly Date: Mon, 11 Nov 2013 14:07:23 GMT Content-Length: 126

The cookie tab shows:

Response sent 1318 bytes of Cookie data: Set-Cookie: UMB_UCONTEXT=694C3[...a lot of text...]D5EDB; expires=Tue, 12-Nov-2013 14:07:23 GMT; path=/; HttpOnly This response did not contain a P3P Header.

So we can conclude:


Solution

  • I was able to fix this. The reason why the UMB_UCONTEXT cookie wasn't created was that I fixed the error

    Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

    the wrong way. As How To Fix the: “Validation of viewstate MAC failed” Error (ASP.NET MVC) shows, I needed to create a random machinekey and add it to my web.config