if (!Membership.ValidateUser(LoginCheck.UserName, LoginCheck.Password))
{
LoginCheck.FindControl("WarmingImage").Visible = true;
e.Authenticated = false;
}
else
{
CheckBox CheckUser = (CheckBox)LoginCheck.FindControl("DigitalCertificates");
if (CheckUser.Checked)
{
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates;
foreach (X509Certificate2 X509 in collection)
{
if (X509.Subject == "CN=iOffice")
{
if (!X509.Verify())
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "JavaScript", "<script>alert('数据证书无效!')</script>");
e.Authenticated = false;
break;
}
}
}
}
else
{
Session["user"] = LoginCheck.UserName;
e.Authenticated = true;
}
}
<ClientSideEvents SelectedIndexChanged="function(s, e) {
ASPxClientUtils.SetCookie(DXGetCurrentThemeCookieName(),s.GetSelectedItem().value);
protected void Page_PreInit(object sender, EventArgs e)
{
string themeName = DefaultThemeName;
if (Page.Request.Cookies[GetThemeCookieName()] != null)
{
themeName = HttpUtility.UrlDecode(Page.Request.Cookies[GetThemeCookieName()].Value);
}
string clientScriptBlock = "var DXCurrentThemeCookieName = \"" + GetThemeCookieName() + "\";";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DXCurrentThemeCookieName", clientScriptBlock, true);
this.Theme = themeName;
}
<!--数据库配置-->
<connectionStrings>
<add name="iOfficeconnectionString" connectionString="server=(local);uid=sa;pwd=;database=iOffice;"/>
</connectionStrings>
……
<!--错误页面配置-->
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
……
<appSettings>
<!--数据库备份位置-->
<add key="backupExists" value="../DataBackup/" />
<!--用户文件存储位置-->
<add key="currentuserfile" value="../UserFile/" />
<!--公司文件存储位置-->
<add key="companyfile" value="../CompanyFile/" />
<!--职工头像位置-->
<add key="EmployeePhoto" value="../CompanyFile/EmployeePhoto/" />
<!--车辆照片存储位置-->
<add key="CarsPhoto" value="../CompanyFile/CarPhoto/" />
</appSettings开源oa系统源码>
……
<!--用户管理-->
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="10" hashAlgorithmType="">
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="iOfficeconnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" password
AttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<!--用户角管理-->
<roleManager enabled="true" cacheRolesInCookie="true">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="iOfficeconnectionString" applicationName="/" />
</providers>
</roleManager>……
Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlEncode(file.Name)); //解决中文文件名乱码
Response.AddHeader("Content-length", file.Length.ToString());
Response.ContentType = "appliction/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论