i currently run a local version of umbraco 4.0.2.1. I also work as an intern at a small software development company in holland and they want a new website that is developed with umbraco.
The problem is i'm busy with creating some controls and i know how to get them to work in umbraco and also know how to create my own package and use it on other umbraco installs. I created a register controll and whithin that register control the user can put in a redirection page and in wich role the user should be put. This is working. But to made this work i had to first make a member group and member type and had to change the defaultMemberTypeAlias of UmbracoMembershipProvider in the web.config.
My question:
Is there a way to make it go automaticly that when you install the package that i'm creating, it automaticly creates the member groups and types and edits the defaultMemberTypeAlias of UmbracoMembershipProvider in the web.config?
I hope i made my question understandable since it was kinda hard for me to formulate it in the right way.
You can specify a usercontrol you want the package to load once the install is compelte. In this usercontrol you could perform the API calls to create the member types, members, etc.
//Proceed for each new node fom supplied xmlData foreach (string groupAlias in groups) { MemberGroup group = MemberGroup.GetByName(groupAlias); newMember.AddGroup(group.Id); }
newMember.Save(); }
private User getUser() { int id = BasePage.GetUserId(BasePage.umbracoUserContextID); id = (id < 0) ? 0 : id; return User.GetUser(id); }
You could always split the above code into package actions, this would be the nicer approach.
However, I believe there's an issue at the moment with specifying your own PackageActions; you need to copy the dll into the bin before installing the package... not ideal.
Makes perfect sense. What you want to do is include some Package Actions in your package that will update the web.config and also makes some member types and groups. See these for info and details...
i tried with the package actions and i know now how to use them to create member types(very easy if you understand how it works =)), but i can't seem to find a way to change defaultMemberTypeAlias="TestType" From the umbracomembershipprovider To defaultMemberTypeAlias="Gebruiker" in the umbracomembershipprovider in the web.config file through package actions, Must i do this through c# code in a web user control? .
you should do this through a package action. It would read the membership provider from web.config, change the defaultMemberType attribute and save the web.config again.
Have a look at the packageactionscontrib project on Codeplex for some inspiration on building such a package action.
I would also go for the package action option. It's really simple to implement. I have the same suggestion as Dirk, download the package action contrib source code and documentation. In the documentation you'll find a link to the Package Action Tester, an awesome tool to test Package actions.
Then you need a little basic understanding how to read xml and update web.config properties. This is done in the AddAppConfigKey Action of the project.
What I would like to have in the PackageActionsContrib project is a way to update all the properties for a MembershipProvider (not just the defaultMemberTypeAlias ). Don't know if you are allowed to include your code into an open source project. I hope you are:) I can help you with building it offcourse.
Something weird is happening to my macro's. I created a register macro for my page, whenever i put it in my page en publish it for the first time, the macro is fine, but whenever i save it later again, cause of a litle change, my macro becomes a normal register table.
I used the .net register component for my controll.
does some one know if this is a bug or is something wrong with my register control? i tried a fresh register controll couple of times.
I'm developing my user control in vs 2008 with asp.net 3.5
Controls/package question
Hi,
i currently run a local version of umbraco 4.0.2.1. I also work as an intern at a small software development company in holland and they want a new website that is developed with umbraco.
The problem is i'm busy with creating some controls and i know how to get them to work in umbraco and also know how to create my own package and use it on other umbraco installs. I created a register controll and whithin that register control the user can put in a redirection page and in wich role the user should be put. This is working. But to made this work i had to first make a member group and member type and had to change the defaultMemberTypeAlias of UmbracoMembershipProvider in the web.config.
My question:
Is there a way to make it go automaticly that when you install the package that i'm creating, it automaticly creates the member groups and types and edits the defaultMemberTypeAlias of UmbracoMembershipProvider in the web.config?
I hope i made my question understandable since it was kinda hard for me to formulate it in the right way.
Dutch greets,
Walter
Hi Walter,
You can specify a usercontrol you want the package to load once the install is compelte. In this usercontrol you could perform the API calls to create the member types, members, etc.
Here's some code to get you started (find the full source in http://our.umbraco.org/projects/clientarea)
You could always split the above code into package actions, this would be the nicer approach.
However, I believe there's an issue at the moment with specifying your own PackageActions; you need to copy the dll into the bin before installing the package... not ideal.
Chris
Hi, Walter,
Makes perfect sense. What you want to do is include some Package Actions in your package that will update the web.config and also makes some member types and groups. See these for info and details...
http://umbraco.org/documentation/books/package-actions-reference
http://umbraco.org/assets/package%20actions.pdf
http://packageactioncontrib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28296
cheers,
doug.
Hi,
Thnx for the quick reply. Gonna test this out when i'm comming home(i'm creating everything on my laptop) since its almost time to go home here.
Will post my results when i tried it here in the topic.
Thnx again for the quick answer.
Heyy All,
i tried with the package actions and i know now how to use them to create member types(very easy if you understand how it works =)), but i can't seem to find a way to change defaultMemberTypeAlias="TestType" From the umbracomembershipprovider To defaultMemberTypeAlias="Gebruiker" in the umbracomembershipprovider in the web.config file through package actions, Must i do this through c# code in a web user control? .
Thank you all for your help. Greets Walter
Hi Walter,
you should do this through a package action. It would read the membership provider from web.config, change the defaultMemberType attribute and save the web.config again.
Have a look at the packageactionscontrib project on Codeplex for some inspiration on building such a package action.
Cheers,
/Dirk
Hi Walter,
As Dirk mentions there are packageActions that project that edit the webconfig. Hopefully you can use some of that code as a starting point.
Hi Walter,
I would also go for the package action option. It's really simple to implement. I have the same suggestion as Dirk, download the package action contrib source code and documentation. In the documentation you'll find a link to the Package Action Tester, an awesome tool to test Package actions.
Then you need a little basic understanding how to read xml and update web.config properties. This is done in the AddAppConfigKey Action of the project.
What I would like to have in the PackageActionsContrib project is a way to update all the properties for a MembershipProvider (not just the defaultMemberTypeAlias ). Don't know if you are allowed to include your code into an open source project. I hope you are:) I can help you with building it offcourse.
Cheers,
Richard
So basicly i need to create my own package action like the ones in the package action contrib source that will enable to change the value;
Thnx guys.
Hi Walter,
Yes that is all you need to do
Cheers,
Richard
Doing a bit c# coding of my own, i found out the following code allowed me to change the defaultMembertypeAlias:
{
Modify(Label1.Text,TextBox1.Text);
}
{
{
membershipSection.Providers[
"UmbracoMembershipProvider"].Parameters.Set(key,value);
configuration.Save();
}
}
Something weird is happening to my macro's. I created a register macro for my page, whenever i put it in my page en publish it for the first time, the macro is fine, but whenever i save it later again, cause of a litle change, my macro becomes a normal register table.
I used the .net register component for my controll.
does some one know if this is a bug or is something wrong with my register control? i tried a fresh register controll couple of times.
I'm developing my user control in vs 2008 with asp.net 3.5
thnx in advance
Hi Walter,
It's better to create a seperate issue for this so the subject makes more sense for the problem you are having.
Cheers,
Richard
OKey i will do that.
is working on a reply...