Frage

I want to implement an alert box to alert the current visitor to log in or register to continue browsing in my ASP.net MVC 4 web application. Can someone explain how to check if the current visitor is already a member or logged in?

Some background about my web app:

  1. Visitors can visit my website to track which events are available (for participation);
  2. Visitors need to register first (on my website) before they can participate at the events.

I appreciate any help.

War es hilfreich?

Lösung

Try this:

User.Identity.IsAuthenticated 

It returns true if the user is logged in, and false otherwise.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top