Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Request doesnot exist in the current context

$
0
0

Hi

In my following code asp.net mvc core , Error message is coming 'Request doesnot exist in the current context'

@if (Request.IsAuthenticated) 'Request doesnot exist in the current context'  . Please can you let me know how to fix this error.

When I click the definition of the Request,  there is no reference into the namespace System.Web.WebPages. How can I give the reference  to the Sytem.web.webpages.

In my  previous mvc project [not mvc core] I can see web config class and there is  some reference , how can I add this reference in mvc core project as long as there is no web config file. Please can you help

@model IEnumerable<MyApplication.Models.Navbar><header class="main-header"><!-- Logo --><a href="#" class="logo"><span class="logo-mini"><b>S</b>App</span><span class="logo-lg"><b>Shift </b>App</span></a><nav class="navbar navbar-static-top"><a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">Toggle navigation</span></a><img style="height:43px;width:220px;" class="logoimg" src="~/Content/shiftapplogo.png" /><div class="navbar-custom-menu">

                @if (Request.IsAuthenticated)
                {
                    <ul class="nav navbar-nav"><li class="dropdown user user-menu"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="~/Content/person.png" class="user-image" alt="User Image"><span class="hidden-xs">@User.Identity.Name  </span></a></li><li class="dropdown user user-menu"><a href="@Url.Action("Login", "Account")"> Sign out</a></li></ul>

                }
            </div></nav></header><aside class="main-sidebar"><!-- sidebar: style can be found in sidebar.less --><section class="sidebar"><ul class="sidebar-menu"><li class="header">MAIN NAVIGATION</li>
                @foreach (var item in Model)
                {<li class="@item.activeli"><a href="@Url.Action(item.action, item.controller)"><i class="@item.imageClass"></i> @item.nameOption</a></li>
                }</ul></section><!-- /.sidebar --></aside>


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>