我有一个非常奇怪的问题,
这是我背后的 Default.aspx 页面代码:
protected void Page_Load(object sender, EventArgs e)
{
WebUtils.WriteLog("On the login page");
if (IsPostBack)
{
if (!String.IsNullOrEmpty(txtUsername.Text) && !String.IsNullOrEmpty(txtPassword.Text))
{
WebUtils.WriteLog("On essai de connecter" + txtUsername.Text);
UIBase temp = new UIBase();
FIQFacade facade = temp.facade;
User user = (User)facade.userFact.GetObjectByLoginName(txtUsername.Text);
if (user != null)
{
WebUtils.WriteLog("User Trouvé" + txtUsername.Text);
if (user.Password == WebUtils.getMd5Hash(txtPassword.Text))
{
User userLogin = (User)facade.userFact.GetObjectByLoginName(txtUsername.Text);
if (userLogin != null)
{
Session[UIBase.CST_LOGGED_USER] = userLogin;
WebUtils.WriteLog("On ce log" + txtUsername.Text);
Response.Redirect("pages/ReservationSalleInterne.aspx");
}
}
else if (facade.userFact.UserLoginDataIsValid(txtUsername.Text, txtPassword.Text, "NDS", configs["ldapPath"].ToString(), ""))
{
User userLogin = (User)facade.userFact.GetObjectByLoginName(txtUsername.Text);
Session[UIBase.CST_LOGGED_USER] = userLogin;
WebUtils.WriteLog("On ce log" + txtUsername.Text);
Response.Redirect("pages/ReservationSalleInterne.aspx");
}
}
}
}
else
{
WebUtils.WriteLog("On est pas en postback on delogue" );
Session[UIBase.CST_LOGGED_USER] = null;
Session["langue"] = "1";
}
}
}
这是我的 Defautl.aspx 页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<!doctype html>
<!--[if lt IE 8 ]><html lang="en" class="no-js ie ie7"><![endif]-->
<!--[if IE 8 ]><html lang="en" class="no-js ie"><![endif]-->
<!--[if (gt IE 8)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Desa Altilogix</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Global stylesheets -->
<link href="css/reset.css" rel="stylesheet" type="text/css">
<link href="css/common.css" rel="stylesheet" type="text/css">
<link href="css/form.css" rel="stylesheet" type="text/css">
<link href="css/standard.css" rel="stylesheet" type="text/css">
<link href="css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" href="favicon-large.png">
<!-- Modernizr for support detection, all javascript libs are moved right above </body> for better performance -->
<script src="js/libs/modernizr.custom.min.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page login-bg dark">
<section id="login-block">
<div class="block-border"><div class="block-content">
<!--
IE7 compatibility: if you want to remove the <h1>,
add style="zoom:1" to the above .block-content div
-->
<div class="block-header"><img src="images/LogoDesa.png" style="height:70px;"/></div>
<!--<p class="message error no-margin">Error message</p>-->
<form class="form with-margin" name="login-form" id="login" runat="server">
<input type="hidden" name="a" id="a" value="send">
<p class="inline-small-label">
<label for="login"><span class="admin">Utilisateur</span></label>
<asp:TextBox type="text" name="login" id="txtUsername" class="full-width" value="" runat="server" />
</p>
<p class="inline-small-label">
<label for="pass"><span class="admin">Mot de passe</span></label>
<asp:TextBox TextMode="Password" name="pass" id="txtPassword" class="full-width" value="" runat="server"/>
</p>
<button type="submit" class="float-right" runat="server" Text="Login">Se connecter</button>
<p class="input-height">
<input type="checkbox" name="keep-logged" id="keep-logged" value="1" class="mini-switch" checked="checked">
<label for="keep-logged" class="inline">Rester connecté</label>
</p>
</form>
</div></div>
</section>
<!--
Updated as v1.5:
Libs are moved here to improve performance
-->
<!-- Generic libs -->
<script src="js/libs/jquery-1.6.3.min.js"></script>
<script src="js/old-browsers.js"></script> <!-- remove if you do not need older browsers detection -->
<!-- Template libs -->
<script src="js/common.js"></script>
<script src="js/standard.js"></script>
<!--[if lte IE 8]><script src="js/standard.ie.js"></script><![endif]-->
<script src="js/jquery.tip.js"></script>
<!-- example login script -->
</body>
</html>
所以我的问题是,当我尝试登录我的网站时,页面刷新并没有任何反应,起初我认为我的用户验证错误,所以我放了一些日志。但是我发现当我尝试登录并且登录不起作用时,日志永远不会被写入。
我认为错误不在我的代码中,我认为它可能是 IIS 配置。当我使用 Visual Studio Express 服务器进行本地浏览时,我似乎没有出现错误。
但是当我在真正的服务器上时,问题偶尔会发生。当我遇到问题时,我有两个解决方案:1-执行 IISRESET 或 2-等待 3-5 分钟后问题消失,直到它随机返回...
请帮我。谢谢。
如果您想了解更多信息,请询问,我将等待回答或收到解释。
谢谢 !
编辑 :
几天前我已经发布了这个:.net dropDownList 在 IE 中回发后失去价值
我也刚刚在此页面中添加了日志,这是同样的问题。当我的下拉列表停止工作时,日志不会被写入。真是奇怪的问题,希望有人能帮助我。
编辑 2:
这是我的 web.config
<?xml version="1.0" encoding="UTF-8"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="conn_string" value="data source=HY-SQL;initial catalog=reservation;user id=UserAboveReservation;password=UserAboveReservation" />
<add key="defaultUserID" value="1" />
</appSettings>
<connectionStrings />
<system.web>
<sessionState mode="InProc" />
</system.web>
</configuration>
编辑 3:
即使您不知道解决方案,也可能给了我一个提示或想法……因为我现在正在抽空。起初我认为这是一个会话问题,但是当我看到日志没有写入文件时,我失去了所有希望;)也许这是一个 cookie 问题,客户端的问题......请帮助 :)