[Autorize]

I want to set the page if the user is not currently login in MVC.
How can I do it?
I want to set it in "User/Login"

You can set this in your web.config eg:

  <system.web>
    <customErrors mode="Off" ></customErrors>
    <compilation debug="true" targetFramework="4.5" ></compilation>
    <httpRuntime targetFramework="4.5" ></httpRuntime>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" ></forms>
    </authentication>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" ></add>
        <add namespace="System.Web.Mvc" ></add>
        <add namespace="System.Web.Mvc.Ajax" ></add>
        <add namespace="System.Web.Mvc.Html" ></add>
        <add namespace="System.Web.Optimization" ></add>
        <add namespace="System.Web.Routing" ></add>
        <add namespace="System.Web.WebPages" ></add>
      </namespaces>
    </pages>
  </system.web>

Thank you Sir. This is all I want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.