首页 新闻 会员 周边

错误 1 源文件“E:\c#\page\Pageeg\Pageeg\page.aspx.cs”未能打开(“此实现不是 Windows 平台 FIPS 验证的

0
悬赏园豆:60 [已关闭问题] 关闭于 2016-11-17 20:45

      我在写一个登陆界面的时候最后生成解决方案出现了这个问题,不知道时怎么回事。希望大家能帮我谢谢。

这个就是出现的问题,然后在网上搜了一下,改了注册表里的东西。

 

用的方法是: 

  1. Win+R(或点击开始-运行),并输入regedit后确定,启动注册表编辑器。
  2. 浏览到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy,将Enabled的值改为0
  3. 关闭注册表编辑器后,重新启动助手。

 

然后就去掉了一个错误还剩一个:

下面是登录界面和代码:

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Web;
 5 using System.Web.UI;
 6 using System.Web.UI.WebControls;
 7 
 8 namespace Pageeg
 9 {
10     public partial class page : System.Web.UI.Page
11     {
12         protected void Page_Load(object sender, EventArgs e)
13         {
14             //读取cookie值
15             HttpCookie userCookie =Request.Cookies["userAuth"];
16             //非空
17             if (userCookie != null)
18             { 
19                     string name= userCookie["username"];
20                     string pass = userCookie["userpass"];
21                     //模拟检测用户名密码是否匹配
22                     if (name == "admin" && pass == "1234")
23                     { 
24                             //隐藏登录
25                         this.paLogin.Visible = false;
26                        //显示信息
27                         this.laUserName.Text = name;
28                         this.paShow.Visible = true;
29                     }
30             }
31         }
32 
33         protected void btnLogin_Click(object sender, EventArgs e)
34         {
35             string name = this.txtName.Text.Trim();
36             string pass = this.txtPass.Text.Trim();
37             //模拟登录
38             if (name == "admin" && pass == "1234")
39             {
40                 //隐藏登录框
41                 this.paLogin.Visible = false;
42                 //显示用户名
43                 this.laUserName.Text = name;
44                 //显示信息框
45                 this.paShow.Visible = true;
46                 //若选中自动登录,生成cookie
47                 if (this.cbAuto.Checked == true)
48                 {
49                     //登录成功后写入cookie
50                     HttpCookie userCookie = new HttpCookie("userAuth");
51                     userCookie["username"] = name;
52                     userCookie["userpass"] = pass;
53                     //设置cookie的过期时间为一个月后
54                     userCookie.Expires = DateTime.Now.AddMonths(1);
55                     Response.Cookies.Add(userCookie);
56                 }
57             }
58             else
59             { 
60                //弹出错误对话框
61                 if (!Page.ClientScript.IsStartupScriptRegistered("error"))
62                 { 
63                      Page.ClientScript.RegisterStartupScript(this.GetType(),"error","alert('用户名或密码错误')",true);
64                 }
65             
66             
67             }
68         }
69 
70         protected void lbExit_Click(object sender, EventArgs e)
71         {
72             //隐藏信息框
73             this.paShow.Visible = false;
74             //显示登录框
75             this.paLogin.Visible = true;
76             this.txtName.Text = "";
77             this.txtPass.Text = "";
78             //删除cookie
79             HttpCookie userCookie =Request.Cookies["userAuth"];
80             if (userCookie != null)
81             {
82                 userCookie.Expires = DateTime.MinValue;
83                 Response.Cookies.Add(userCookie);
84             }
85         }
86 
87         
88     }
89 }

大概出现错误的时候是在代码63行左右就出现了错误提示;

 

 

希望大神能详细解答一下;谢谢。

 

 

 

 

 

 

 

 

 

 

 

 

 

问题补充:

把页面的代码也传上来,大家帮我看看

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="page.aspx.cs" Inherits="Pageeg.page" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style2
        {
            height: 37px;
        }
        .style6
        {
            width: 130px;
        }
        .style9
        {
            width: 60px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Panel ID="paLogin" runat="server" style="margin-left: 143px" Width="535px">
           <table border="1" style="width: 300px; margin-left: 0px">
  <tr>
    <td class="style9">&nbsp;用 户 名:</td>
    <td class="style6">
        <asp:TextBox ID="txtName" runat="server" Width="149px"></asp:TextBox>
      </td>
  </tr>
  <tr>
    <td class="style9">&nbsp; 密码:</td>
    <td class="style6">
        <asp:TextBox ID="txtPass" runat="server"></asp:TextBox>
      </td>
  </tr>
  <tr>
    <td class="style2" colspan="2">
        <asp:CheckBox ID="cbAuto" runat="server" 
            oncheckedchanged="cbAuto_CheckedChanged" Text="一个月内自动登录" />
      </td>
  </tr>
  <tr>
    <td class="style2" colspan="2">
        <asp:Button ID="btnLogin" runat="server" onclick="btnLogin_Click" Text="登录" />
      </td>
  </tr>
</table>
        </asp:Panel>
      <asp:Panel ID="paShow" runat="server" Visible="False">
          <asp:Label ID="laUserName" runat="server"></asp:Label>
          <asp:LinkButton ID="lbExit" runat="server" onclick="lbExit_Click"></asp:LinkButton>
            </asp:Panel>
    </div>
    </form>
</body>
</html>
薯条哥哥的主页 薯条哥哥 | 初学一级 | 园豆:100
提问于:2016-09-11 11:55
< >
分享
所有回答(1)
0

你试着换个路径这种c# 的路径看着都蛋疼  csharp

mading | 园豆:206 (菜鸟二级) | 2016-09-13 15:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册