Who can help me, i have a create button on my View layout for login, it has this fields username and password, login button(this validates if the user exist) and create(this i am struggling to link it).
I have this on my AppStart
, RouteConfig.cs
logic below; The question must i need to create that logic on this file(Create page functionality on RouteConfig.cs
)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace eNtsaPortalWebsiteProject
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace eNtsaPortalWebsiteProject
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Account", action = "Create", id = UrlParameter.Optional }
);
}
}
}
Views/Account/Create.cshtml
page something that will link this route to handle load from the web? I don't know please assist me, as i still new to MVC web development.
Logic for login on Views/Account/login.cshtml
:
@model eNtsaPortalWebsiteProject.Models.Login
@{
ViewBag.Title = "Login";
}
@{
Layout = "~/Views/Shared/_LoginLayout.cshtml";
}
<script src="~/Scripts/jquery-1.9.1.js"></script>
<script src="~/bootstrap/js/bootstrap.min.js"></script>
<script src="~/Scripts/jquery.min.js"></script>
<link href="~/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<div data-="mainContent">
<section class="container">
<div class="logo col-sm-12 text-center col-md-12"> <img alt="" src="~/Images/eNtsa.png" /></div>
<div class="clearfix"></div>
<div class="container">
<div class="row">
<div id="MyWizard" class="formArea LRmargin">
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div id="divMessage" class="text-center col-md-12 col-md-offset-12 alert-success">
@Html.ValidationSummary()
</div>
<div class="glyphicon-log-out col-sm-12 text-center col-md-12"> <img alt="" src="~/Images/gcobani.jpg" /></div>
<div class="clearfix"></div>
<div class="col-md-12 col-md-offset-10 col-xs-12">
<div class="loginPage panel-info">
<span class=""><i class="glyphicon glyphicon-user">Username</i></span>
<div class="form-group text-center">
@Html.TextBoxFor(model => model.username, new { @class = "form-control text-center", autocomplete = "off" })
@Html.ValidationMessageFor(model => model.username)
</div>
<div class="form-group">
<span class=""><i class="glyphicon glyphicon-user">Password</i></span>
@Html.PasswordFor(model => model.password, new { @class = "form-control text-center", autocomplete = "off" })
@Html.ValidationMessageFor(model => model.password)
</div>
</div>
<div class="form-group">
<input id="BtnLogin" type="submit" class="btn btn-success btn-pressure" name="BtnLogin" value="Login" />
<input id="BtnReset" type="reset" value="Create" class="btn btn-info btn-pressure" name="BtnReset" value="Reset" />
</div>
</div>
}
<div class="clear"></div>
</div>
</div>