User umbraco role provider in separate application
Hi
I have an existing website application, I would like to start using umbraco to create new websites. But i would like all my old websites to use the same user store - provided by my umbraco installation.
So far, I have successfully shared the member sessions across the appplications, a member can log into my umbraco website and the member is also logged into my second app.
Now I would like to access the roles for the member as they are set in my umbraco installation.
so, User.Identity.Name, gives me the correct member name as logged into my umbraco front end. trying to check the user role i get the following,
'User.IsInRole("Admin")' threw an exception of type 'System.TypeInitializationException'
the inner exception looks like such:
The type initializer for 'umbraco.BusinessLogic.Application' threw an exception.System.Exception {System.TypeInitializationException}
the above exception lies here:
SqlHelper'umbraco.BusinessLogic.Application.SqlHelper' threw an exception of type 'System.TypeInitializationException'umbraco.DataLayer.ISqlHelper {System.TypeInitializationException}
So this is my issue. What could be causing this exception, I must just be missing something...
Here are other details:
Version 4.5.x
Framework 4...everything
Default app pool 4.0
IIS 7
My webconfig for my second app looks like this, these parts taken from my umbraco application:
and i have added the appsetting section from my umbraco installation
<appSettings>
<add key="umbracoDbDSN" value="my working connection string...." />
....
my second app has the following dll references:
businesslogic.dll
cms.dll
interfaces.dll
Microsoft.ApplicationBlocks.Data.dll
umbraco.Datalayer.dll
umbraco.dll
umbraco.Linq.Core.dll
umbraco.macroRenderings.dll
umbraco.providers.dll
i dont think I have missed anything
please help, this i think would be a very useful ability for many ppl wanting to use umbraco without having to move websites into umbraco, but rather just leveraging off it's user store.
I don't directly know what the problem might be, but can you maybe try with Roles.IsUserInRole( User.Identity.Name, "Admin") and see if you get the same kind of error? Maybe it will then help getting a view on the problem.
It must just been dll confusion or something i did wrong. I removed all umbraco references from my project, added only umbraco.providers, which in turn added the other dependancy dlls.
Now i get:
User.IsInRole("Admin")truebool
Thanks for your time, I knew it was just something random like that.
User umbraco role provider in separate application
Hi
I have an existing website application, I would like to start using umbraco to create new websites. But i would like all my old websites to use the same user store - provided by my umbraco installation.
So far, I have successfully shared the member sessions across the appplications, a member can log into my umbraco website and the member is also logged into my second app.
Now I would like to access the roles for the member as they are set in my umbraco installation.
so, User.Identity.Name, gives me the correct member name as logged into my umbraco front end. trying to check the user role i get the following,
'User.IsInRole("Admin")' threw an exception of type 'System.TypeInitializationException'
Hi monster,
I don't directly know what the problem might be, but can you maybe try with Roles.IsUserInRole( User.Identity.Name, "Admin") and see if you get the same kind of error? Maybe it will then help getting a view on the problem.
Cheers,
Michael.
Hi Mike
Thanks for response.
It must just been dll confusion or something i did wrong. I removed all umbraco references from my project, added only umbraco.providers, which in turn added the other dependancy dlls.
Now i get:
User.IsInRole("Admin") true bool
Thanks for your time, I knew it was just something random like that.
So I managed to recreate the error....remember this is a separate application with it's own webconfig etc
As soon as I add the umbraco.dll to the project and then it crashes my IIS..
running any code that is within umbraco.cms.businesslogic namespace.
so
using umbraco.cms.businesslogic.member;
Member m = Member.GetCurrentMember();
works perfectly until I reference umbraco.dll.
is there possible some configuration setting that I am missing that the umbraco.dll is dependant on.
really just want to reference the umbraco dlls in my separate app, and use them. this article http://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-whats-next-after-you-install/setting-up-your-project-in-visual-studio says we should be able to do that easily - but I am wondering if this is not fully possible.
If i change my appsettings here:
<add key="umbracoPath" value="/Bin" />
I get different results...the above breaks IIS, just "/" my member comes back as null. No umbraco.dll in project i get the full member.
any ideas?
Thanks
I realise I am trying to reinvent the wheel, I will just use the umbraco webservices to that which i need. thanks again.
is working on a reply...