문제

I'm staging an ASP Web Forms application for system testing. We have two URLs that will use the same code, changing their content based on the URL. So I configured two virtual directories in IIS to map to one physical path. Say the virtual directories are TTP/Site1 and TTP/Site2, and they both map to TTP/SiteCommon.

However, the Default.aspx page raises a CS1061 compilation error:

CS1061: 'ASP.ttp_site1_default_aspx' does not contain a definition for 'btn_login_Click' and no extension method 'btn_login_Click' accepting a first argument of type 'ASP.ttp_site1_default_aspx' could be found (are you missing a using directive or an assembly reference?)

The error is on this line:

<asp:Button ID="btn_login" runat="server" Text="Log in" OnClick="btn_login_Click" />

I get the same message for TTP/Site2, and on the same line.

I looked up prior Stack Overflow questions, and confirmed that btn_login_Click in Default is protected not private.

Any ideas?

ETA per request:

    protected void btn_login_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/login.aspx");

    }

ETA2:

<%@ Page Title="" Language="C#" MasterPageFile="~/main.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RIF.Default1" %>

올바른 솔루션이 없습니다

다른 팁

Make sure your class is named Default1 and it's in the RIF namespace.

Also, if you're using Web Site instead of Web Application Project, change CodeBehind to CodeFile. See MSDN.

<%@ Page Title="" Language="C#" MasterPageFile="~/main.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="RIF.Default1" %>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top