Jus*_*els 3 .net dotnetnuke dotnetnuke-module reactjs
一旦当前登录的用户到达我们的 DotNetNuke 页面上托管的我的应用程序,我就会尝试获取他们。该应用程序是用 React.JS 构建的,我在 HTML 模块内渲染它。当用户到达应用程序时,我将执行 ComponentDidMount 方法调用,并向我的 .ascx 文件发起 AJAX 请求以获取当前用户。(ComponentDidMount 仅在应用程序加载时自动调用一次 - 对于所有阅读本文的 .NET 用户)。进入 ASCX 文件后,我将执行下面的代码,但只获得“user”的输出。我是否应该调用一个类来在另一个文件中使用此令牌?我可以在下面的代码中做什么来让当前用户登录到该站点(遗憾的是,DNN 不使用会话变量,仅使用令牌)。
.ascx 代码:
<%
Response.Write("user " & [User:UserName])
%>
Run Code Online (Sandbox Code Playgroud)
小智 5
I don't understand your design, but I can answer your question. The square bracket tokens are replacements that are done within the HTML module content. You can't use them in server-side .ascx. You would need to call the a core DNN API method to get the user from the server-side .ascx code:
<%
Response.Write("user " & DotNetNuke.Entities.Users.UserController.Instance.GetCurrentUserInfo().Username);
%>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2491 次 |
| 最近记录: |