目前我的 URL 中顯示了電子郵件,建議使用 https 進行通信,并且電子郵件需要顯示在正文中而不是 URL 中。有人可以幫我解決這個問題。下面是我的代碼:
//URL BUILDER CODE
[AllowAnonymous]
[HttpGet]
public ActionResult Authorize(string code, string state = null)
{
LoginResult loginResult = this.authenticationService.LogUserInToCommonAuthentication(code);
this.CreateSessionForUser(loginResult);
string uri = "/";
if (loginResult.Success)
{
this.Response.Cookies.Add(loginResult.AuthCookie);
}
else
{
this.logger.Warn($"Authorize - The user {loginResult.Email} has not been authorized - ErrorCode={loginResult.Error}");
uri = string.Format(CultureInfo.InvariantCulture, "?User={0}&Code={1}", loginResult.Email, loginResult.Error);
return this.Redirect(uri);
}
long unixUtcTimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
return this.Redirect(uri "?d=" unixUtcTimestamp);
}
下面是我的 index.cshtml
//TO DISPLAY IN THE BODY
@if (Request.QueryString["Code"] == "401" || Request.QueryString["Code"] == "500")
{
<li style="color: white; font-size: 16px; text-align: left; padding: 20px; line-height: 150%">
Dear User,<br>
@(Request.QueryString["User"]). This email does not seem to be authorized to use the application.
</li>
}
請幫我解決這個問題。如果需要更多資訊,請發表評論并提前致謝:)
uj5u.com熱心網友回復:
我在這里使用了 Session ,它在我的情況下有效。請在下面找到,例如:
// Add this in the controller
Session["Email"] = loginResult.Email;
并在 .html 檔案中呼叫 Session。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/527175.html
標籤:C#。网网址加密剃刀
