注销按钮不起作用 [英] logout button not working

查看:75
本文介绍了注销按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ Page language="c#" Codebehind="admin.aspx.cs" AutoEventWireup="false" Inherits="Repository.admin" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Admin Login</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<LINK rel="stylesheet" type="text/css" href="css/style.css">
		<script type="text/javascript"> 
		<!-- 	
			function _doPostBack(eventTarget, eventArgument, FolderTitle, DocTitle)
			{	
						
				document.Form1._EVENTTARGET.value = eventTarget;				
				document.Form1._EVENTARGUMENT.value = eventArgument;				
				document.Form1._FOLDERTITLE.value = FolderTitle;				
				document.Form1._DOCTITLE.value = DocTitle;			
															
				document.Form1.submit();
			}
			
			function showmenu(elmnt)
			{
			document.getElementById(elmnt).style.visibility="visible";
			}
			function hidemenu(elmnt)
			{
			document.getElementById(elmnt).style.visibility="hidden";
			}
				
		--> 
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
				<tr>
					<td><input type="hidden" name="_EVENTTARGET"> <input type="hidden" name="_EVENTARGUMENT">
						<input type="hidden" name="_DOCTITLE"> <input type="hidden" name="_FOLDERTITLE">
						<div>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td valign="middle" align="center"><IMG border="0" alt="right" src="images/right-logo.png" height="25"></td>
								</tr>
							</table>
						</div>
						<div>
							<table border="0" width="100%" align="right">
								<tr>
									<td  önmouseover="showmenu('admin')" önmouseout="hidemenu('admin')"><asp:imagebutton id="admin1" tabIndex="1" runat="server" Height="45" ImageUrl="images/admin.png"

											EnableViewState="False">
										<table id="admin" class="menu" border="0" width="150">
											<tr>
												<td class="menu"><a href="createuser.aspx">Create User</a></td>
											</tr>
											<tr>
												<td class="menu"><a href="myaccount.aspx">Manage Users</a></td>
											</tr>
										</table>
									</td>
									<td valign="top" align="right">
										<asp:Button ID="Logout" EnableViewState="False" Runat="server" Text="Logout">
									</td>
								</tr>
							</table>
						</div>
						<div>
							<table border="0" width="100%">
								
							</table>
						</div>
						<div id="bodySection">
							<table border="1" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td valign="top">
										<div id="Div_FolderLoad"  runat="server"><asp:label id="Lbl_FoldersLoad" EnableViewState="False" Runat="server"></td></tr></table></div>
									</td>
									<td valign="top" width="100%">
										<div id="Div_TitleLoad"  runat="server"><asp:label id="Lbl_TitleLoad" EnableViewState="False" Runat="server">
										<div id="Div_DocumentLoad"  runat="server"><asp:label id="Lbl_DocumentLoad" EnableViewState="False" Runat="server">
									</td>
								</tr>
							</table>
							<div style="POSITION: relative; TOP: 10px">
								<table border="0" cellspacing="0" cellpadding="0" width="100%">
									<tr>
										<td valign="top" width="22" align="left"><IMG alt="All rights reserved." src="images/footer_left.gif" width="22" height="44"></td>
										<td class="footer" valign="middle" align="right">©2013 right. All rights 
											reserved.</td>
										<td valign="top" width="22" align="left"><IMG alt="All rights reserved" src="images/footer_right.gif" width="22" height="44"></td>
									</tr>
								</table>
							</div>
						
					
				
			
		</form>
	</body>
</HTML>







using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.IO;
using System.Web.Mail;

namespace Repository
{
	/// <summary>
	/// Summary description for index.
	/// </summary>
	public class admin : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Lbl_TitleLoad;
		protected System.Web.UI.WebControls.Label Lbl_DocumentLoad;
		protected System.Web.UI.HtmlControls.HtmlGenericControl Div_FolderLoad;
		protected System.Web.UI.HtmlControls.HtmlGenericControl Div_TitleLoad;
		protected System.Web.UI.HtmlControls.HtmlGenericControl Div_DocumentLoad;
		protected System.Web.UI.WebControls.Label Lbl_FoldersLoad;
		protected System.Web.UI.WebControls.Button Logout;
		string rowSelected = String.Empty;
		string folderTitle = "GENERAL";
		string docTitle = String.Empty;
		protected System.Web.UI.WebControls.ImageButton admin1;
		
		bool titleOnClick = false;
	
		private void Page_Load(object sender, System.EventArgs e)
		{	
			if(Request.Form["_EVENTTARGET"] == "FolderTitle")
			{
				this.GetPostBackEventReference(this, "arg");

				folderTitle = this.Request["_FOLDERTITLE"];
				
				PageProcess();
				
			}

			if (Request.Form["_EVENTTARGET"] == "DocTitle")
			{
				this.GetPostBackEventReference(this, "arg");
		
				docTitle = this.Request["_DOCTITLE"];
				folderTitle = this.Request["_FOLDERTITLE"];
				
				if(docTitle.Equals(String.Empty) == false)
				{
					titleOnClick = true;

					PageProcess();
				}
			}

			if(Page.IsPostBack == false)
			{
				PageProcess();			
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{	
			this.Logout.Click += new System.EventHandler(this.Logout_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void PageProcess()
		{
			Div_DocumentLoad.Visible = false;
			Div_TitleLoad.Visible = false;	
	
			Lbl_FoldersLoad.Text = FoldersLoad();	

			if(titleOnClick == true)
			{
				Div_DocumentLoad.Visible = true;	
				SaveOrOpenDocument();
			}
			else
			{
				Div_TitleLoad.Visible = true;
				Lbl_TitleLoad.Text = TitleLoad();
			}		
		}

		private string FoldersLoad()
		{
			string classText = String.Empty ;				
			string folderName = String.Empty;
			string docXMlPath = Server.MapPath("~/");
						
			docXMlPath += System.Configuration.ConfigurationSettings.AppSettings["REPOSITORY_DOCUMENT_FILE"];

			XmlDocument xDoc = new XmlDocument();
			xDoc.Load(docXMlPath);

			if(xDoc != null)
			{
				classText = "<table align="left" cellpadding="5" cellspacing="0" border="1">";

				XmlNode xNode = xDoc.SelectSingleNode("//DOCUMENTS-PAGE");

				if(xNode!= null)
				{
					XmlNodeList folderList = xNode.ChildNodes;	
	
					if((folderList != null) && (folderList.Count > 0))
					{
						foreach(XmlNode folderNode in folderList)
						{
							folderName = folderNode.Name.ToString();
							classText += "<tr><td align="left" nowrap=""><a id="FolderTitle" href="\"javascript:_doPostBack('FolderTitle'," mode="hold" />
							if((titleOnClick == true) && (folderName.ToUpper().Equals(folderTitle) == true))
							{
								XmlNodeList docList = folderNode.ChildNodes;	

								if((docList != null) && (docList.Count > 0))
								{	
									foreach(XmlNode docNode in docList)
									{
										if(docNode!= null)
										{
											string subDocTitle = String.Empty;

											string flDocTitle = docNode.Attributes["TITLE"].Value;

											if(docTitle.Length > 10)
											{
												subDocTitle = docTitle.Substring(0, 10)+"...";
											}
											else
											{
												subDocTitle = docTitle;
											}
									
											classText += "<tr><td style="text-indent: 2em" align="left" nowrap=""><a id="DocTitle" title=""+flDocTitle+"" href="\"javascript:_doPostBack('DocTitle',">
										}
									}
								}
							}
						}
					}
				
				}

				classText += "</a></td></tr></td></tr></table>";

			}
			return classText;
		}

		private string TitleLoad()
		{
			string classText = String.Empty;
			string docTitle = String.Empty;	
			string docXMlPath = Server.MapPath("~/");
						
			docXMlPath += System.Configuration.ConfigurationSettings.AppSettings["REPOSITORY_DOCUMENT_FILE"];

			XmlDocument xDoc = new XmlDocument();
			xDoc.Load(docXMlPath);

			if(xDoc != null)
			{
				classText = "<table width="100% align=" centre=" cellpadding=" 5=" cellspacing=" 0=" border=" 1="> ";<br mode="hold" /><br mode="hold" />				XmlNode xNode = xDoc.SelectSingleNode("//DOCUMENTS-PAGE//"+folderTitle);<br mode="hold" /><br mode="hold" />				if(xNode!= null)<br mode="hold" />				{<br mode="hold" />					XmlNodeList list = xNode.ChildNodes;	<br mode="hold" /><br mode="hold" />					foreach(XmlNode docNode in list)<br mode="hold" />					{<br mode="hold" />						if(docNode!= null)<br mode="hold" />						{<br mode="hold" />							docTitle = docNode.Attributes["TITLE"].Value;<br mode="hold" /><br mode="hold" />							classText += "<tr><td align=" left=" noWrap><A id=" doctitle=" href = \"javascript:_doPostBack("></table>

推荐答案

I don’t see any event handler for your Logout button. You can create an event handler for Logout button and write the following code:



FormsAuthentication.SignOut();



I hope this will resolve your problem.
I don't see any event handler for your Logout button. You can create an event handler for Logout button and write the following code:

FormsAuthentication.SignOut();

I hope this will resolve your problem.


这篇关于注销按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆