我在母版页上创建了一个按钮,当我点击它时它会注销,它应该关闭会话并重定向到Login。
登录是起始页面,它不在主页中,它只是一个单独的aspx页面。
我不知道它为什么不起作用。我在按钮方法中设置了断点,但是当我单击按钮时,事件不会被触发。
按钮是 Salir
请帮帮我。
这是主页的代码:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Principal.master.cs" Inherits="Web.Principal" %>
<!DOCTYPE html>
<html lang="zxx" class="no-js">
<head>
<!-- Mobile Specific Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Favicon-->
<link rel="shortcut icon" href="img/fav.png">
<!-- Author Meta -->
<meta name="author" content="Colorlib">
<!-- Meta Description -->
<meta name="description" content="">
<!-- Meta Keyword -->
<meta name="keywords" content="">
<!-- meta character set -->
<meta charset="UTF-8">
<!-- Site Title -->
<title>Destinos Naturales S.A</title>
<link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
<!--
</head>
<body>
<form id="form1" runat="server">
<!-- Start Header Area -->
<header class="default-header">
<div class="container">
<div class="header-wrap">
<div class="header-top d-flex justify-content-between align-items-center">
<div class="logo">
<a href="Principal.aspx"><img src="img/logo.png" alt=""></a>
</div>
<div class="main-menubar d-flex align-items-center">
<nav class="hide">
<a href="Principal.aspx">
<asp:Button ID="bntInicio" runat="server" Text="Inicio" BorderWidth="0" BackColor="Transparent"/>
</a>
<a href="Usuario.aspx">
<asp:Button ID="btnUsuarios" runat="server" Text="Usuarios" BorderWidth="0" BackColor="Transparent"/>
</a>
<a href="Articulos.aspx">
<asp:Button ID="btnArticulos" runat="server" Text="Artículos" BorderWidth="0" BackColor="Transparent"/>
</a>
<a>
<asp:Button ID="btnSalir" runat="server" Text="Salir" ForeColor="#800000" BorderWidth="0" BackColor="Transparent" OnClick="btnSalir_Click"/>
</a>
</nav>
<div class="menu-bar"><span class="lnr lnr-menu"></span></div>
</div>
</div>
</div>
</div>
</header>
<!-- End Header Area -->
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
<!-- start footer Area -->
<footer class="footer-area section-gap">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="single-footer-widget">
<h6>Destinos Naturales S.A</h6>
<p>
Destinos turísticos nacionales e internacionales.
</p>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="single-footer-widget mail-chimp">
<h6 class="mb-20">Instragram</h6>
<ul class="instafeed d-flex flex-wrap">
<li><img src="img/i1.jpg" alt=""></li>
<li><img src="img/i2.jpg" alt=""></li>
<li><img src="img/i3.jpg" alt=""></li>
<li><img src="img/i4.jpg" alt=""></li>
<li><img src="img/i5.jpg" alt=""></li>
<li><img src="img/i6.jpg" alt=""></li>
<li><img src="img/i7.jpg" alt=""></li>
<li><img src="img/i8.jpg" alt=""></li>
</ul>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="single-footer-widget">
<h6>¡Síguenos!</h6>
<p></p>
<div class="footer-social d-flex align-items-center">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
</div>
</div>
</div>
</div>
<div class="footer-bottom d-flex justify-content-center align-items-center flex-wrap">
<p class="footer-text m-0">
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | Hecho por Alejandra Porras Araya</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</p>
</div>
</div>
</footer>
<!-- End footer Area -->
</body>
</html>
,这是按钮代码:
protected void btnSalir_Click(object sender, EventArgs e)
{
Session["UsuarioIngresado"] = null;
Response.Redirect("Login.aspx");
}
答案 0 :(得分:0)
您的代码中包含无效的html评论。 <!--
是不触发btnSalir_Click
事件的原因。
删除<!--
应该可以解决问题。
<link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
<!--
^^^^^