So, I have code in controller:
FormsAuthentication.SetAuthCookie("hello", true);
throw new Exception("" + User.Identity.IsAuthenticated);
And it always displays false. What the reason can be?
The user will be authenticated on the next request only, when he starts sending the cookie back. Forms authentication happens at the start of requests only. You can change HttpContext.Current.User to a custom authenticated identity if you really need to, but you should do a redirect instead.