本文介绍了如何从其他页面重定向到masterpage.master的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我想使用'responce redirect'从其他页面转到主页。在母版页中,我有一个按钮'BtnHome',点击事件名为OnClick =BtnHomeClick。

当我使用下面的代码并单击主页按钮时,它会显示:'类型您请求的页面未被提供,因为它已被明确禁止。扩展程序.master可能不正确。请查看下面的网址,确保拼写正确。'

以下我提交代码:



In my project I want to go to Home page from other page using 'responce redirect'. In master page I have the button 'BtnHome' with a click event named as OnClick="BtnHomeClick".
When I use the following code and click the 'Home' button , it says :'The type of page you have requested is not served because it has been explicitly forbidden. The extension '.master' may be incorrect. Please review the URL below and make sure that it is spelled correctly.'
Hereunder I submit the code:

protected void BtnHomeClick(object sender, EventArgs e)
    {
        Response.Redirect("~/MasterPage.master");
    }










<asp:Button ID="BtnHome"  runat = "server" Text='Home' Font-Size="Medium"  PostBackUrl="~/MasterPage.master" OnClick="BtnHomeClick" Font-Bold="true"  ForeColor="White" BackColor="Teal"  CausesValidation="false"

            style=" margin-top:16px; cursor:pointer;  margin-left:225px"   BorderStyle="None" > </asp:Button>

推荐答案


这篇关于如何从其他页面重定向到masterpage.master的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 11:13