I am creating a web application and I have 2 text fields and one button with input field
<input id="Login" type="submit" onclick="location.href='@Url.Action("loggedin","logincontroller")'" style="" width="200" height="34" value="submit" />
and my controller looks like
public ActionResult loggedin(string role, string username, string password)
{
webservice.loginservice a= new webservice.loginservice();
a.getlogintype(role, username, password);
return View();
}
with my web service
[WebMethod]
public string getlogintype(string role, string username, string password)
{
string strtru="";
string strfalse="";
sqlcon;
SqlCommand cmd = new SqlCommand("select * from [admin] where userid='" + username + "' and pass ='" + password + "'", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
strtru = "true";
}
else
{
strfalse = "false";
}
con.Close();
}
My controller calls a web service, and now I want to know how to redirect the page to a successful check. This is my first application using mvc. I know that there are a lot of errors in this application (please let me know all the errors).
I am creating an application on mvc 5 and I use only the input fields, and not @Htmlbecause I want to create it ( beta2.hti-india.com ) this application was created by me in asp.net C #.
user6656724
source
share