How to signout user in asp.net MVC 5?

Viewed 7166

I'm trying to sign out a user when a session object don't exist with following code in my View:

FormsAuthentication.SignOut();

But this doesn't work - the user is already authenticated.

I've seen that the default LogOff Controller Action use this code to signout a user:

AuthenticationManager.SignOut();

But I can't use this code in my view.

So how can I logout a user in my View? Or when it's not possible how can I do this in a Controller?

Thanks for help :)

1 Answers
Related