3
I’m developing a Solution in the object-oriented programming class for the web. Let’s create a stock control system. One of the first "screens" of access, is the login, only at this moment, my entire 'application' already goes downhill.
In the first screen, we have the login and password field, when we click on the 'login' button is called a method, which queries the login in the bank, but the return is always 'Invalid login'
Method FazLogin
return Contexto.tblUsuario
.Where(u => u.LOGIN == usuario && u.SENHA == senha).FirstOrDefault() != null;
Through Visual Studio itself, if we make a query in the database, I can see the table tblUsuario
and I can also see my users for testing. In the Connection string, it’s like this:
<connectionStrings>
<add name="ModeloEstoqueContextoContainer" connectionString="metadata=res://*/ModeloEstoqueContexto.csdl|res://*/ModeloEstoqueContexto.ssdl|res://*/ModeloEstoqueContexto.msl;provider=System.Data.SqlClient;provider connection string="data source=LENOVO-PC\SQLEXPRESS;initial catalog=ESTOQUE_DATABASE;user id=sa;password=SENHAXXXXX;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
We are working on the MVC model, and yes, the references have been checked several times, both by me and the teacher.
@Gypsy, Metadata (Connection String) is automatically generated by Entity Framework
@pnet, The password is not encrypted, it is a very simple thing that we are doing in college, when typing the password, we have a answer. Redirect that directs to the other page. By debugging always Count = 0 and values are null.
I’m not getting the controller here.
This
connetion string
is very suspicious. What is the need to pass the Metadata on it?– Leonel Sanches da Silva
Dude, a question. At your bank is the password encrypted? If you are, you would need to decrypt to make the comparison. Something else, debugging your Return, is something coming? Can you post your controller so we can understand better? This is easier. As for Morrison’s comment, this is normal, because Entity already mounts it like this, with Metadata. It’s the same with me and it works properly.
– pnet