Visual Studio 2017的智能感知无法识别母版页

时间:2019-07-02 12:45:30

标签: c# asp.net webforms master-pages

在我的C#Visual Studio 2017解决方案中,我的IntelliSense无法识别母版。

当我编译解决方案或网站时,在识别MasterPage时出现错误。

尽管如此,当我运行网站正常工作时。

还有其他人建议解决此问题吗?

请查看Visual Studio 2017附带的图像

enter image description here

enter image description here

代码母版页:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Odbc;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Mpims : MasterPage
{

    public static string Base64ForUrlDecode(string str)
    {
        byte[] decbuff = HttpServerUtility.UrlTokenDecode(str);
        return Encoding.UTF8.GetString(decbuff);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

        }
    }
}

带有MasterPage的Webform CS:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class sDefault : Page
{
    string sql;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            sql = @String.Format(" SELECT * FROM doTable WHERE sID = ?; ");

            using (OdbcConnection cn =
              new OdbcConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
            {
                using (OdbcCommand cmd =
                    new OdbcCommand(sql, cn))
                {
                   try
                   {
                        command.Parameters.AddWithValue("param1", Mpims.Base64ForUrlDecode(Request.QueryString["sID"]).ToString().ToUpper());
                        command.Connection.Open();

                        using (OdbcDataReader reader = 
                           command.ExecuteReader())
                        {
                           if (reader.HasRows)
                           {
                               while (reader.Read())
                               {
                                     ...
                               }
                           }
                        }    
                   }                
                   catch (Exception ex)
                   {
                       throw new ApplicationException("operation failed!", ex);
                   }
                   finally
                   {
                      command.Connection.Close();
                   }
                }
            }
        }
    }
}

带有MasterPage的Webform aspx:

<%@ Page Title="" Language="C#" MasterPageFile="Mpims.master" AutoEventWireup="true" CodeFile="sDefault.aspx.cs" Inherits="sDefault" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" 
runat="Server">
</asp:Content>

请向我解释问题所在。

0 个答案:

没有答案
相关问题