2013-10-21 35 views
2

我有一个很奇怪的问题,Asp.net网站结构,网页没有书面方式记录

这里是我的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> 

所以我的问题是,当我想要在我的网站登录,页面刷新,并没有发生,起初我在想,我Uservalidation错了,所以我把一些日志。但是我发现日志从来没有写入,当我试图登录和登录不起作用。

我不认为这个错误是在我的代码我认为这可能是一个IIS配置。当我使用Visual Studio Express服务器进行本地浏览时,我似乎没有发生错误。

但是当我在真正的服务器上时,偶尔会发生问题。当我遇到问题时,我有两个解决方案:1-执行IISRESET或2-等待3-5分钟后问题消失,直到它随机回来...

请帮助我。谢谢。

如果您想了解更多信息,只需询问,我会等待回答或收到解释。

谢谢!

编辑:

我已经张贴这几天前:.net dropDownList losing value after postback in 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:

即使你不知道的解决方案,也许给了我一个提示或一个想法...因为我现在拉着我的空气。起初我很难这是一个会议的问题,但是当我看到日志没有写在文件中,我已经失去了所有希望;)也许这是一个饼干问题,客户端...请帮助:)

回答

0

我发现问题了!!!

输出缓存在IIS中为所有.aspx页面启用。

删除此更正了我所有的问题。

谢谢大家!