How to create proper login to access trough [Authorize] (MVC database-first)

By : skylake
Source: Stackoverflow.com
Question!

I'm new to MVC and so far I've created some pages. As I only want to let members access to the site I've added [Authorize] for these pages so other are redirected to to login/register page. But I've no clue about the next steps.

How do I give authorization upon success login? Do I use session for the current logged user?

I got MVC template which already have its own login, but I want to create my own, using database(database-first) to get better understanding.

Any help is much appreciate. Thanks.

By : skylake


Answers

Using below article where you can learn how to integrate existing database in ASP.NET MVC 5 web application using ADO.NET database first approach and how to configure simple login work flow for integrating existing logins with the ASP.NET MVC 5 web application with OWIN middle ware secure authorization mechanism.

Article : Integrating Existing Database With Login Using ADO.NET Database First Approach

    [Authorize]  
    public class HomeController: Controller  
    {  
       public ActionResult Index()  
        {  
            return this.View();  
        }
    }  

Note :

used [Authorize] attribute at controller level to secure access to Home controller for authenticated users only.

By : Sampath


Depends on how accurate you want the speedtest to be, the larger the file the more accurate it is. But this can be a big annoyance/data hog for the user.

The big number appears because it's in bytes, to get Mb/s you need to do Your result / 1024^2.



Disable attribute only associates button and input filelds, the thing you want to do here is , event.preventDefault . It will work like disable, but it will depend upon your coding, if you want to show it disabled, you have to add add via jquery



This video can help you solving your question :)
By: admin