asp.net mvc - Sign in as a different user using MVC.NET and Windows Authentication? -


How can I use it MVC.NET? I've got resources on the Internet about how to do in ASP.NET, but I have not found a way to do this in MVC.NET (I'm a MVC.NET novice, though). I can generate a 401 response using [authorized] attributes, but I do not have any information about what to do next.

[edit] While playing around some time, I felt that if I could find a way to force myself to re-sign and apply for the login dialog, I would like to I might be able to. I think if I authorize something like authorization (authorize (user = "none")] then it should bring the login dialog. Is there another way to force it to re-authenticate, because the above Hack is too much waste because it will refuse access yet.

You can register using the following code At the time of each user Roles: Crele roll (rollname); roles.Audousorol (user name, rollname);

"Administrator" or "user" Or the name of the role as "employee" or "customer", or whatever you want, you should do it at the time of registration.

Then you define that users There is a difference to use for. If you only use the method below You need to define the role in the form of "Admin", then you must define the role as "Admin"

[HttpGet] [Authorize (roles = "admin")] View Public Action View {List & lt; Inventory & gt; Inventory = New list & lt; Inventory & gt; (); Inventorylist = Connect Database Select Inventory (); See Return ("View Event", inventory); }

If you only need to use the method below, then you must define the role as "user"

  [HttpGet] [Author (roles = "users")) View public functionsEvents list () {List & lt; Inventory & gt; Inventory = New list & lt; Inventory & gt; (); Inventorylist = Connect Database Select Inventory (); See Return ("View Event", inventory); }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -