小编Kat*_*tya的帖子

HttpContext.Current.User.Identity.Name的问题

在大约100多个用户使用表单身份验证登录到站点的环境中,调用HttpContext.Current.User.Identity.Name将返回正确登录的用户.

但是,有10%的时间返回了错误的用户全名信息.我的测试机器上从未出现过这样的问题,它只发生在生产中.我无法在我的测试机器上为许多用户重新创建相同的环境.

这个应用程序的逻辑:

1)用户输入用户名并通过,通过SQL DB调用查询信息,如果匹配,则通过FormsAuthentication.RedirectFromLoginPage(username,false)验证用户

 FormsAuthentication.SetAuthCookie(user.SYS_Users_ID.ToString(), false);

 if (Request["ReturnURL"] == null)
    FormsAuthentication.RedirectFromLoginPage(user.SYS_Users_ID.ToString(), false);
 else
     Response.Redirect("/" + SysConfig.ApplicationName + appConfig.DefaultPages.DefaultPage);
Run Code Online (Sandbox Code Playgroud)

2)重定向后,我将用户全名放入隐藏字段

if (!IsPostBack)
     userFullName.Value = Helper.GetCurrentUserFullName();

...

public static string GetCurrentUserFullName()
{
    string _userFullName = string.Empty; 
    try
    {
        _userFullName = new AgrotMasofim.DAL.Users.Users().GetUserFullName(GetCurrentUserID());
    }
    catch (Exception ex)
    {
        Logs.WriteToFileLog(string.Empty,ex);
    }
    return _userFullName;
 }



public static Decimal GetCurrentUserID()
        {
            Decimal _userID = 0;

            if (HttpContext.Current.User != null)
            {
                try
                {
                    _userID = Convert.ToDecimal(HttpContext.Current.User.Identity.Name);
                }
                catch (Exception ex)
                {
                   Logs.WriteToFileLog(string.Empty, ex);
                }
            }
            return …
Run Code Online (Sandbox Code Playgroud)

asp.net forms-authentication httpcontext

6
推荐指数
1
解决办法
2684
查看次数

jqPlot - 如何更改canvasOverlay的不透明度或z-index?

我想在我的图表上根据y轴值显示3个颜色区域,据我所知,我无法通过不同的颜色控制背景颜色.

我的想法是用canvasOverlay绘制3条水平线 - 这是有效的.问题是我想把这条线放在我的图形曲线后面,现在它在前面看到它覆盖了我的点线.

我可以更改z-index的属性或不透明度吗?

也许其他一些想法?

  $.jqplot( 'ChartDIV', [data],
        {
            series: [{ showMarker: true}],
            highlighter: {
                sizeAdjust: 10,
                show: true,
                tooltipLocation: 'n',
                useAxesFormatters: true
            },

            tickOptions: {
                formatString: '%d'
            },
            canvasOverlay: {
                show: true,
                objects: [ 
                            {
                                horizontalLine: 
                                {      
                                    name: 'low', 
                                    y: 1.0,
                                    lineWidth: 100,
                                    color: 'rgb(255, 0, 0)',
                                    shadow: false 
                                }
                            },      
                            {
                                horizontalLine:
                                { 
                                    name: 'medium',
                                    y: 2.0,
                                    lineWidth: 100, 
                                    color: 'rgb(250, 250, 0)', 
                                    shadow: true 
                                }
                            },
                            {
                                 horizontalLine:
                                {
                                    name: 'high',
                                    y: 3.0,
                                    lineWidth: 100,
                                    color: …
Run Code Online (Sandbox Code Playgroud)

jqplot

5
推荐指数
1
解决办法
1万
查看次数