Session management in asp.net Code first
<p>I use a custom authentication in my project, and I can't manage the session to get the user permission in route. <strong>This is my code</strong> :</p>

<p><strong>Admin controller</strong></p>

<pre><code>// POST: administration
[HttpPost]
public ActionResult Login(Admin admin)
{
    var user = AdminContext.admins.SingleOrDefault(u =&gt; u.Email == admin.Email &amp;&amp; u.Pass == admin.Pass);

    if (user != null)
    {
        Session["adminID"] = user.adminID;
        Session["adminNom"] = user.Nom.ToString() + " " + user.Prenom.ToString();

        if (System.IO.File.Exists(Server.MapPath("~" + user.Photo)))
        { Session["adminPhoto"] = "~" + user.Photo; }
        else
        { Session["adminPhoto"] = "~/Content/TemplateAdmin/assets/images/no_img.png"; }

        return RedirectToRoute("Dashboard");
    }
    else
    {
        ModelState.AddModelError("", "Email ou mot de passeest incorrect");
        return View("~/Views/Administration/Login.cshtml");
    }
}
</code></pre>

<p><strong>Project route</strong></p>

<pre><code>public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        name: "LoginAdmin",
        url: "administration",
        defaults: new { controller = "Admin", action = "Login" }
    );

    routes.MapRoute(
        name: "Dashboard",
        url: "administration/dashboard",
        defaults: new { controller = "Dashboard", action = "Index"}
    );

    routes.MapRoute(
        name: "Profile",
        url: "administration/profile",
        defaults: new { controller = "Admin", action = "Profil" }
    );

    routes.MapRoute(
        name: "Gestion_admins",
        url: "administration/gestion_admins/{action}/{id}",
        defaults: new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
    );
}
</code></pre>

<p><strong>Should I check session for all ActionResult in my project ?</strong>  Like this :</p>

<pre><code>// POST: Profil
[HttpPost]
public ActionResult Profil(Admin model)
{
    if (Session["adminID"] != null)
    {
        model.adminID = Convert.ToInt32(Session["adminID"]);
    }
}
</code></pre>