我在此代码附近的 cshtml 文件中收到此错误
@{
var options = new OpenIdSelector();
options.TextBox.LogOnText = "Log On";
}
解析器错误
说明:解析服务此请求所需的资源时出错。请查看以下特定的解析错误详细信息并适当地修改您的源文件。
解析器错误消息:“@”字符后出现意外的“{”。一旦进入代码块的主体(@if {}、@{} 等),您就不需要使用“@{”来切换到代码。
@using DotNetOpenAuth.Mvc
@using DotNetOpenAuth.OpenId.RelyingParty
@{
ViewBag.Title = "Log On";
}
<div id="login-oauth">
<h3>via 3rd Party (recommended)</h3>
@{ Html.RenderPartial("LogOnContent");}
</div>
<div id="or">OR</div>
<div id="login-account">
<h3>using a account</h3>
</div>
@using (Html.BeginForm())
{
<div>
<p>
<label for="username">Username:</label>
@(Html.TextBox("username"))
@(Html.ValidationMessage("username", "*"))
</p>
<p>
<label for="password">Password:</label>
@(Html.Password("password"))
@(Html.ValidationMessage("password", "*"))
</p>
<p>
@(Html.CheckBox("rememberMe")) <label class="inline" for="rememberMe">Remember me?</label>
</p>
<p>
<input class="classiclogon" type="submit" value="Log On" />
</p>
<p>
Please enter your username and password. @(Html.ActionLink("Register", "Register")) if you don't have an account.
</p>
</div>
@{
{
var options = new OpenIdSelector();
options.TextBox.LogOnText = "Log On";
}
}
@MvcHtmlString.Create(Html.OpenIdSelectorScripts(options, null))
@* @(Html.OpenIdSelectorScripts(this.Page, options, null))*@
}