admin管理员组

文章数量:1122832

I'm working on an ASPX project using .NET Framework in Visual Studio 2022. My pages inherit a base class BasePage, which contains a helper function GetVersionedPath. Here's the relevant setup:

Page:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="analitica.aspx.vb" Inherits="VisualIntelligence.analitica" %>
<%@ Register Src="~/Controls/Sidebar.ascx" TagName="Sidebar" TagPrefix="uc" %>
<link href="<%= GetVersionedPath("../assets/styles/dashboard.min.css") %>" rel="stylesheet" />

Code-Behind for the Page:

Public Class analitica
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.Cookies("jwt_token") Is Nothing Then Response.Redirect("../Login.aspx")
        If TokenManager.GetPrincipal(Request.Cookies("jwt_token").Value) Is Nothing Then Response.Redirect("Login.aspx")
    End Sub
End Class

Base Page:

Public Class BasePage
    Inherits Page

    Private Shared _version As String

    Protected ReadOnly Property Version As String
        Get
#If DEBUG Then
            Return Date.Now.ToString("yyyyMMddHHmmss")
#Else
            If String.IsNullOrEmpty(_version) Then
                _version = ConfigurationManager.AppSettings("AppVersion")
            End If
            Return _version
#End If
        End Get
    End Property

    Protected Function GetVersionedPath(relativePath As String) As String
        Return $"{ResolveUrl(relativePath)}?v={Version}"
    End Function
End Class

The application runs without issues, and the GetVersionedPath function works as expected at runtime. However, Visual Studio 2022 displays the following IntelliSense error for the <%= GetVersionedPath(...) %> usage in the ASPX file:

BC30451: 'GetVersionedPath' is not declared. It may be inaccessible due to its protection level.

My Environment:

  • Visual Studio 2022
  • .NET Framework 4.7.2

What could be causing IntelliSense to fail in recognizing GetVersionedPath, even though the application runs fine? How can I resolve this?

本文标签: