ASP.NET MVC Bootstrap Access Control Edition

Asked

Viewed 319 times

0

Good Morning!

I have a project created and in it already contains an access control system that was created automatically when I created the project, I wonder if it would be possible to edit this access control or if it would be better to create a new one, I would like to send the data to a table in my database, currently it is using this connection:

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-Administracao-20151103112933.mdf;Initial Catalog=aspnet-Administracao-20151103112933;Integrated Security=True" providerName="System.Data.SqlClient" />

What should I do to save these records in my comic book? (below my connection to my comic book)

    <add name="naescola" connectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=NaEscola;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;Min Pool Size=50" />
  • Explain better what your access control is: ASP.NET Identity, Membership or it’s something more customized?

2 answers

1

Just you change the DefaultConnection to point to your bank, it will create all tables (all from scratch).

 <add name="DefaultConnection" connectionString="Data Source=IP;Initial Catalog=NOBD;Persist Security Info=True;User Id=USUARIO;Password=SENHA;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />

This mine is one that I did exactly what you want, to Sqlserver

  • But how can I know which tables and fields to DefaultConnection precise? I have a table Login{ idLogin, User, password, privilege, email } , it will automatically identify?

  • It will create everything for you, as it does on localdb.

  • would it have to look like this on my Connection? <add name="DefaultConnection" connectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=NaEscola;Persist Security Info=True;User Id=USUARIO;Password=SENHA;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />

  • No, you are pointing to (localdb), take my answer and exchange the IP, NOBD, USER and PASSWORD if sqlserver

  • It is SQL Server, however as my database is test this in my localhost, there is no user and password, I placed (localdb) pq in my other Nection this (localdb) also <add name="DefaultConnection" connectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=NaEscola;Persist Security Info=True;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" /> this way would be correct?

  • You have to test.. create a connection in conection explores, there is a visual to create, then take the connection string generated in it and use, it will work.

Show 1 more comment

1

You need to create a link between your project and your database, the Entity Framework is responsible for this, for those who are starting the Wizard plenty of help.

In the Model of your project, when right-clicking, choose the Option Add à New Item. On the screen that will appear choose the option Date in the browser, which is on the left side, and the square on the right choose the option ADO.NET Entity Data Model. In the example below the project name is Controleacesso.Cs.

inserir a descrição da imagem aqui

You can follow the rest of the step by step HERE.

References: Devmidia.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.