I have asp mvc site www.mysite.com
. I want to create controller with method, that returns view on specific url - register.mysite.com
. I want to create hidden section of mysite for admins to add new data into site DB. How i can do id?
Asked
Active
Viewed 145 times
1
1 Answers
1
You can't really 'hide' sections of your site, other than not providing a link to it.
Main points
- protect the section with
[Authorize(role="Admins")]
- Somewhere in one of your Views, provide a conditional Link to it.
Point 1) is the real security.
Point 2) would best be done in a Child Action that creates a Model for your menu. Second choice is something like this:
@if(User.IsInRole("Admins"))
{
@Html.ActionLink(...)
}

H H
- 263,252
- 30
- 330
- 514
-
mysite is only shown information from db, users can't register and don't have any account. But admins may login on site and add new data to db. – isxaker Sep 28 '13 at 11:40
-
Account was just an example, put constraints on all your editing Controllers. For the subdomain, see the linked duplicate. But note that you can always create a separate App for the subdomain. – H H Sep 28 '13 at 11:42