有人请帮忙:我将此声明添加到我的partialview登录页面
Someone please help out: I added this statement to my partialview login page
@HttpContext.Current.Session["userID"] = User.Identity.GetUserId().ToString();并收到以下错误:
编译错误
描述:在编译服务此请求所需的资源期间发生错误.请查看以下特定错误详细信息并适当修改您的源代码.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
编译器错误消息:CS1525:无效的表达式术语="
Compiler Error Message: CS1525: Invalid expression term '='
源错误:
第 66 行:#line default第 67 行:#line hidden第 68 行:EndContext("~/Views/Shared/_LoginPartial.cshtml", 73, 37, false);第 69 行:第 70 行:
Line 66: #line default Line 67: #line hidden Line 68: EndContext("~/Views/Shared/_LoginPartial.cshtml", 73, 37, false); Line 69: Line 70:
推荐答案我只是直接使用 User.Identity.GetUserId 而不是 session 变量.
I just use User.Identity.GetUserId directly instead of session variable.
谢谢大家.
不过,如果有人能解释该错误的含义,我将不胜感激.
Still, I appreciate it if someone can explain what that error means though.
更多推荐
在partialview MVC中获取会话变量错误
发布评论