Использую iis express, проект asp.net mvc4, visual studio community 2015. windows 7
Первый раз запускаю сайт, грузится и переходит на страницу авторизации, как и задумано в маршрутах. Дальше нажимаю кнопку зарегистрировать, страница грузится, и дальше никакого результата, только вечная загрузка, как будто зацикливание.
Останавливаю проект, запускаю заново, и теперь даже бесконечно грузится главная страница.
В гугл хром нажал f12, чтобы посмотреть какие скрипты запускаются. Пусто.
Куда копать? Сам код:
public class AuthorizationController : BaseController
{
public AuthorizationController()
{
ViewBag.IsDisplayTopMenu = false;
ViewBag.IsNotAutorized = true;
HtmlHelper.ClientValidationEnabled = true;
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
}
[HttpGet, ActionName("SignUp")]
public ActionResult SignUpGet()
{
SignUpModel model = new SignUpModel();
var countries = GetCountrySelectList();
ViewBag.Countries = countries;
ViewBag.Cities = GetCitiesSelectList(Int32.Parse(countries.First().Value));
//model.Birthday = DateTime.UtcNow;
return View(model);
}
[HttpPost, ActionName("SignUp")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> SignUpPost(SignUpModel model)
{
SelectList tempList;
// 1 - Валидация
if (ModelState.IsValid)
{
// 2 - Проверяем на дублирование почты пользователя
User user = _unitOfWork.UserRepository.Get(x => x.Email.Equals(model.Email) && !x.IsDeleted).SingleOrDefault();
if (user != null)
{
ModelState.AddModelError("user", "Пользователь с таким адресом электронной почты уже зарегистрирован.");
model.Password = string.Empty;
model.ConfirmPassword = string.Empty;
tempList = GetCountrySelectList();
ViewBag.Countries = tempList;
ViewBag.Cities = GetCitiesSelectList(Int32.Parse(tempList.First().Value));
return View(model);
}
//DateTime birthday;
//var isDateValid = DateTime.TryParse(model.Birthday, out birthday);
//if (!isDateValid) ModelState.AddModelError("Birthday", "Birthday needs to be a valid date.");
// 3 - Валидация дня рождения
DateTime currentDate = DateTime.UtcNow;
if (model.Birthday < currentDate.AddYears(-100) || model.Birthday > currentDate.AddYears(-16))
{
ModelState.AddModelError("model.Birthday", "Допустимый возраст пользователей от 16 и старше.");
model.Password = string.Empty;
model.ConfirmPassword = string.Empty;
tempList = GetCountrySelectList();
ViewBag.Countries = tempList;
ViewBag.Cities = GetCitiesSelectList(Int32.Parse(tempList.First().Value));
return View(model);
}
// 4 - Шифруем пароль
String hashedPassword = CryptographyHelper.HashPassword(model.Password);
// 5 - Генерируем ключ активации
String activationToken = CryptographyHelper.GenerateActivationToken();
// 6 - Создаем пользователя и сохраняем его в БД
User dataUser = new User
{
FirstName = model.FirstName,
MiddleName = model.MiddleName,
LastName = model.LastName,
CountryId = model.CountryId,
CityId = model.CityId,
Birthday = model.Birthday,
CreateDate = DateTime.UtcNow,
Email = model.Email,
ConfirmationToken = activationToken,
UserPasswordHash = hashedPassword,
Gender = (int)model.Gender,
Growth = model.Growth,
Weight = model.Weight,
IsDeleted = false,
LastVisitDate = DateTime.UtcNow,
Phone = model.Phone
};
_unitOfWork.UserRepository.Insert(dataUser);
await _unitOfWork.SaveAsync();
// 7 - Отправляем письмо для подтверждения регистрации
if (HttpContext.Request.Url != null)
{
ConfirmRegistrationMailMessage mailMessage =
new ConfirmRegistrationMailMessage(dataUser, HttpContext.Request.Url.AbsoluteUri);
await Emailer.SendMailAsync(mailMessage);
}
return RedirectToAction("RegistrationSuccess");
}
tempList = GetCountrySelectList();
ViewBag.Countries = tempList;
ViewBag.Cities = GetCitiesSelectList(Int32.Parse(tempList.First().Value));
model.Password = string.Empty;
model.ConfirmPassword = string.Empty;
return View(model);
}
public ActionResult RegistrationSuccess()
{
return View();
}
[HttpGet, ActionName("SignIn")]
public ActionResult SignInGet()
{
SignInModel model = new SignInModel();
return View(model);
}
[HttpPost, ActionName("SignIn")]
[ValidateAntiForgeryToken]
public ActionResult SignInPost(SignInModel model)
{
if (ModelState.IsValid)
{
var users = _unitOfWork.UserRepository.Get(x => x.Email == model.Email && !x.IsDeleted);
var user = users.FirstOrDefault();
if (user == null)
{
ModelState.AddModelError("user", "Пользователь не найден.");
model.Password = string.Empty;
return View(model);
}
var password = CryptographyHelper.HashPassword(model.Password);
if (user.UserPasswordHash == password)
{
FormsAuthentication.SetAuthCookie(user.Email, true);
return RedirectToAction("Index", "HealthPanel");
}
else
{
if (user.UserPasswordHash != password)
{
model.Password = string.Empty;
ModelState.AddModelError("user", "Неверный пароль");
}
}
}
model.Password = string.Empty;
return View(model);
}
[HttpGet]
public ActionResult SignOut()
{
FormsAuthentication.SignOut();
return Redirect("signin");
}
}
Views
@model Project.Models.Authorization.SignInModel
@{
ViewBag.Title = "SignIn";
Layout = "~/Views/Shared/_DefaultLayoutForNonAuthorize.cshtml";
}
<script src="~/Content/scripts/sign-in.js"></script>
<!-- Bootstrap core CSS -->
<link href="~/Content/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="~/Content/Styles/page-enter.css" rel="stylesheet" />
<link href="~/Content/Styles/sticky-footer.css" rel="stylesheet">
<link href="~/Content/Styles/style.css" rel="stylesheet">
<body class="page-enter-body">
<!-- Begin page content -->
<header>
<div class="page-top-thr-lv">
<div class="container">
<div class="top-3 page-enter-top-3">
<div class="col-md-5 col-xs-6 page-enter-pull-right">
<div class="col-md-6 col-md-offset-3 logo">
<p class="text-center">text </p>
</div>
<div class="col-md-3 text-center">
<a href="/" title=""><img src="~/Content/img/logo.png" alt="" /></a>
</div>
</div>
</div>
</div>
</div><!--/.page-top-thr-lv -->
</header>
<section class="main-content">
<div class="container">
@using (Html.BeginForm("SignIn", "Authorization", FormMethod.Post))
{
<div class="col-md-4 padding0 feedback">
@Html.AntiForgeryToken()
@Html.ValidationSummary()
<div class="form-group col-md-9 padding0">
<label for="InputEmail">Эл. почта</label>
@Html.TextBoxFor(x => x.Email, new { @class = "form-control", id = "InputEmail", placeholder = "example@mail.com" })
@*<input type="email" class="form-control" id="email" placeholder="example@gmail.com" pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}">*@
</div>
<div class="form-group col-md-9 padding0">
<label for="InputPassword">Пароль</label>
@Html.PasswordFor(x => x.Password, new { @class = "form-control", id = "InputPassword" })
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-4 marginleft105 padding0">
<div class="col-md-12 padding0">
<button type="submit" class="btn btn-send">Войти</button>
}
@Html.ActionLink("Зарегистрироваться", "SignUp", "Authorization", new { @class = "btn btn-send" })
</div>
</div>
</div>
</section><!--/.main-content -->
<div class="bg"></div>
<div id="footer">
<div class="container">
<p class="text-muted">© 2015</p>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="~/Content/scripts/bootstrap.min.js"></script>
</body>
view signup
using ColorLongLife.Utilities
@model ColorLongLife.Models.Authorization.SignUpModel
@{
ViewBag.Title = "SignUp";
Layout = "~/Views/Shared/_DefaultLayoutForNonAuthorize.cshtml";
}
@section scripts
{
<script src="~/Content/scripts/sign-up.js"></script>
@*<script src="~/Content/scripts/bootstrap-datepicker.js"></script>*@
<script src="~/Content/scripts/edit-profile.js"></script>
}
<section class="main-content">
<div class="container">
<div class="col-md-6 padding0">
<h1>Регистрация</h1>
<div class="intro-2">
<p>Все поля обязательны к заполнению, так как играют важную роль при расшифровке диагностики.</p>
</div>
</div>
<div class="clearfix"></div>
@using (Html.BeginForm("SignUp", "Authorization", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary()
<div class="col-md-2 padding0 feedback">
<div class="form-group col-md-12 padding0">
<label for="InputFIO">Фамилия</label>
@Html.TextBoxFor(x => x.LastName, new { @class = "form-control", id = "InputFIO", placeholder = "Зареченская", type = "text" })
</div>
<div class="form-group col-md-12 padding0">
<label for="InputName">Имя</label>
@Html.TextBoxFor(x => x.FirstName, new { @class = "form-control", id = "InputName", placeholder = "Анна", type = "text" })
</div>
<div class="form-group col-md-12 padding0">
<label for="InputSecondName">Отчество</label>
@Html.TextBoxFor(x => x.MiddleName, new { @class = "form-control", id = "InputSecondName", placeholder = "Ивановна", type = "text" })
</div>
<div class="form-group col-md-12 padding0">
<label for="InputBirthday">Дата рождения</label>
@Html.EditorFor(model => model.Birthday, new { htmlAttributes = new { @class = "form-control", id = "InputBirthday" } })
@*@Html.TextBoxFor(x => x.Birthday, "{0:dd.MM.yyyy}", new { @class = "form-control", id = "InputBirthday" })*@
</div>
<div class="radio1">
<p>Пол</p>
@Html.RadioButtonFor(x => x.Gender, Gender.Male, new { name = "rbtnGender", id = "optionsRadios2" })
<label><span class="cbxGender"></span> Мужской</label>
@Html.RadioButtonFor(x => x.Gender, Gender.Female, new { name = "rbtnGender", id = "optionsRadios1" })
<label><span class="cbxGender"></span>Женский</label>
</div>
<div class="form-group col-md-5 padding0">
<label for="weight">Рост (см.)</label>
@Html.TextBoxFor(x => x.Growth, new { @class = "form-control", id = "weight", placeholder = "176" })
</div>
<div class="form-group col-md-5 col-md-offset-2 padding0">
<label for="height">Вес (кг.)</label>
@Html.TextBoxFor(x => x.Weight, new { @class = "form-control", id = "height", placeholder = "69" })
</div>
<div class="form-group col-md-12 padding0">
<label for="country">Страна проживания</label>
@Html.DropDownListFor(x => x.CountryId, ViewBag.Countries as SelectList, "Выберите страну", new { @class = "form-control", id = "country", type = "text" })
</div>
<div class="form-group col-md-12 padding0">
<label for="city">Город</label>
@Html.DropDownListFor(x => x.CityId, ViewBag.Cities as SelectList, "Выберите город", new { @class = "form-control", id = "city", type = "text" })
</div>
<div class="form-group col-md-12 padding0">
<label for="telephone">Телефон</label>
@Html.TextBoxFor(x => x.Phone, new { @class = "form-control", id = "telephone", placeholder = "", type = "text" })
<span><img src="~/Content/img/info.png" />для оперативной связи</span>
</div>
<div class="form-group col-md-12 padding0">
<label for="email">Эл. почта</label>
@Html.TextBoxFor(x => x.Email, new { @class = "form-control", id = "email", placeholder = "ekaterina@mail.com", type = "text" })
@*<span><img src="~/Content/img/error.png" />Эл. почта не введена</span>*@
</div>
<div class="form-group col-md-12 padding0">
<div>
<label for="password">Пароль</label>
@Html.TextBoxFor(x => x.Password, new { @class = "form-control", id = "password", type = "password" })
</div>
<div>
<label for="confirmPassword">Повторите пароль</label>
@Html.TextBoxFor(x => x.ConfirmPassword, new { @class = "form-control", id = "confirmPassword", type = "password" })
</div>
</div>
</div>
<div class="col-md-4 dop paddingleft30">
<p>Регистрация позволит вам воспользоваться всеми услугами персонального кабинета:</p>
<ul class="list-unstyled">
<li><span class="glyphicon glyphicon-ok-sign"> </span>Пройти бесплатное цветовое тестирование, выявляющие психологически проблемные области вашей жизни</li>
<li><span class="glyphicon glyphicon-ok-sign"> </span>Ознакомиться с демо-расшифровками результатов тестирования и осмысленно выбрать нужный вид расшифровки для себя</li>
<li><span class="glyphicon glyphicon-ok-sign"> </span>Воспользоваться платными сервисами, которые позволяют выявить влияние психологических проблем на здоровье</li>
<li><span class="glyphicon glyphicon-ok-sign"> </span>Записаться на консультацию к клиническому психологу по результатам расшифровки теста</li>
<li><span class="glyphicon glyphicon-ok-sign"> </span>Купить персональные курсы цветовой коррекции</li>
<li>
<span class="glyphicon glyphicon-ok-sign"> </span>Увидеть список полезных для вас биологически активных добавок, которые были подобраны по результатам теста и купить их.
</li>
</ul>
<div class="secret">text.</div>
</div>
<div class="col-md-6">
</div>
<div class="clearfix"></div>
<div class="checkbox1 col-md-8 padding0">
<input type="checkbox" value="" checked>
<label><span class="cbxUserAgreement"></span>Я прочитал и согласен с <a href="">Пользовательским соглашением</a></label>
<input type="checkbox" value="" checked>
<label><span class="cbxRegulationsPersonalData"></span>Я прочитал и согласен с <a href="">Положением о персональных данных</a> </label>
<input type="checkbox" value="" checked>
<label><span class="cbxLimitationPprofessionalLiability"></span>Я прочитал и согласен с <a href="">Ограничением профессиональной ответственности</a> </label>
</div>
<div class="clearfix"></div>
<button type="submit" class="btn btn-send">Зарегистрироваться</button>
}
</div>
</section><!--/.main-content -->