ASP.NET MVC 4 Roles [closed] - asp.net

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
what is the best way to manage roles in MVC 4? I found this tutorial:
http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-7
but I want to be flexible and add the back office user the power to create and assing roles to registred user.
Many thanks

The ASP.NET Configuration site mentioned in that tutorial does not even work with SimpleMembershipProvider.
You will need a few custom pages to do the following:
List users
Create/Edit user where you display a list of roles.
Then you can just use the built-in functions such as:
Roles.RoleExists(role)
Roles.CreateRole(role);
Roles.IsUserInRole(username, role)
Roles.AddUserToRole(username, role);
This assumes you are using a built-in provider and the data tables generated by ASP.NET. You can also inherit from the RoleProvider class and implement your own methods.

I don't think that the framework provides an out of the box solution for managing users and roles. It should however be quite easy to roll your own, especially if you use the new SimpleMembership provider.
You can also take a look at the SecurityGuard project, which seems quite nice, but I haven't tried it yet.

Related

Convenient way to navigate throught views on uno-platform [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am very new to UnoPlatform. I am trying to create a new application. Yet for some time I am stuck at creating convenient way to navigate through views.
I searched through webs and forums. I found that the best design pattern would be MVVM. Demo Apps on platform.uno seems to be implemented using this pattern as well. However some approaches i found online are not possible with unoplatform, as far as I understand it.
To give an example:
The app starts at LoginPage. On successful login I want to be taken to a completely different view with different controls. One of the approaches I found is by holding currently active viewmodel and render pages accordingly.
Is there some approach you would recommend for navigating through views? Or some material I could read to understand this concept better?
Using MVVM Light, the navigation needs to be performed using the NavigationService, as you'll find in this documentation: http://www.mvvmlight.net/doc/nav5.cshtml.
You can also use Prism for Uno, which handles navigation per regions. You can find documentation here https://prismlibrary.com/docs/ and samples here: https://github.com/PrismLibrary/Prism/blob/c71957ad56c0cfedf479d46dcb1870c96232d86c/e2e/Uno/HelloUnoWorld.Shared/ViewModels/ShellViewModel.cs#L30

I'm creating an ASP.NET website for selling furniture and I am confused about creating my database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
My Asp template
I'm creating my first ASP.NET website for selling furniture and I am confused about creating my database. I want to sell products for many categories like bedrooms, and every user can add products to cart; here is my master page template
I introduce you a simple database design for the issue using 4 proposed tables in the following:
Persons; to keep your users info in it.
ProductCategories; to keep the product groups in it as mentioned like bedroom.
Products; to keep the all products with their categories.
Carts; actually this is not mandatory, you can manage this by cookies.
Note: This proposal is very very basic and simple, so it can be extended by your needs.
Here is the mentioned tables with their fields(in the minimum) as graphical interface in the Microsoft SQL Server design:

Using Password Recovery control with my own database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to use the password recovery control of asp.net, but with my own database, I dont want to use the membership table that is already provided. Is there a way to do this? I have searched on google but did not get a single one that is relevant to what I want to do. Please Help. Thanks
The general approach to this would be to implement your own MembershipProvider, this would allow you to override the default behaviour. However, you would need to implement all the behaviour, not just the stuff you want to change (see this example).
You can implement the GetPassword / ResetPassword methods and have them work from your own database rather than the membership table.

Design site map page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need to design a site map page of my website in asp.net.
I am confused whether to use custom site map and retrieve information from database, or directly retrieve information from database and bind it to hyperlink...
Please help.
The benefit of using a custom site map provider is that you can use it with the SiteMapPath, Menu, and TreeView controls. You also get access to security trimming, which is nice if your site map changes based upon permissions.
The downside is it can be fairly rigid when it comes to query strings, and you have to jump through the provider model hoops just to retrieve some data from the database.
I would say to use the custom provider if you plan on displaying the sitemap in multiple ways (Menu, SiteMapPath, etc) or need security trimming. If you don't, follow KISS, and just do your basic data access with hyperlinks.

How do I make dynamic content with dynamic navigation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming.
Examples:
a "contact us" form
a report generator
How should I represent/reference the programming within the database? Should I have a varchar value of a Web User Control (.ascx) name? Or a Web Form (.aspx) name? Something else? Or should it just be an integer or other such ID in a dictionary within my application?
Can I make an ASP.NET Site Map Provider with this structure?
See more information here: Which is the best database schema for my navigation?
You might consider inserting placeholders like <my:contact-us-form/> in the database on specific pages; that way the database can describe all the static text content instead of completely replacing that database-driven content with an .ascx control.
Our development team has had success with defining the name of a Web User Control in the database. Upon page load it checks too see what controls to dynamically load from the database.
We use Web User Controls instead of Web Forms in order to ensure we can use the control on any page.
You can also dynamically build a site map using ASP.Net's provider. CodeProject has a good example.

Resources