ASPX似乎无法找到code后面? [英] ASPX can't seem to find code behind?

查看:148
本文介绍了ASPX似乎无法找到code后面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,真是丢在这里。无论出于何种原因,我的.aspx将只承认当Page指令使用codeFILE背后的code,而不是codeBehind。此外,它给出了运行时解析错误。但我需要codeBehind发布网站。


  • 在Web应用程序中所有其他网页使用codeBehind。

  • 我试图删除并重新创建该文件,甚至留空,仍然是一个错误。

  • 我试图删除文件设计师和在.aspx转换为Web应用程序。

  • 页面指令引用(命名空间,类)是正确的。

  • 试图删除的obj。

  • 尝试清洗和重建。

我在这里走了选项。到目前为止,我GOOGLE的一切都没有摇出。为什么不能codeBehind用?!

感谢。

编辑:

的.aspx

 <%@页标题=LANGUAGE =C#的MasterPageFile =〜/应用/硕士/ Default.MasterAutoEventWireup =真codeBehind = BlogPost.aspx.cs继承=WebApplication.App.Templates.BlogPost%GT;

.aspx.cs

 命名空间WebApplication.App.Templates
{
    公共部分类博文:BaseTemplate
    {


解决方案

也许你的 .csproj的文件不知何故被损坏?

请检查您的文件(S)的入口看起来像这样在你的项目文件:

 <编译包括=BlogPost.aspx.cs>
  < D​​ependentUpon> BlogPost.aspx< / DependentUpon>
  <亚型GT; ASPX codeBehind< /亚型GT;
< /编译>
<编译包括=BlogPost.aspx.designer.cs>
  < D​​ependentUpon> BlogPost.aspx< / DependentUpon>
< /编译>

OK, really lost here. For whatever reason my .aspx will only recognize the code behind when the Page directive is using CodeFile and not CodeBehind. Also, it gives a parser error on runtime. But I need CodeBehind to publish the site.

  • Every other page in the web application uses CodeBehind.
  • I've tried deleting and recreating the file, even leaving it empty, still an error.
  • I've tried deleting the designer file and converting the .aspx to a web application.
  • The page directive references (namespace, class) are correct.
  • Tried deleting the obj.
  • Tried cleaning and rebuilding.

I'm out options here. Everything I've googled so far hasn't panned out. Why can't CodeBehind be used?!

Thanks.

Edit:

.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/App/Masters/Default.Master" AutoEventWireup="true" CodeBehind="BlogPost.aspx.cs" Inherits="WebApplication.App.Templates.BlogPost" %>

.aspx.cs

namespace WebApplication.App.Templates
{
    public partial class BlogPost : BaseTemplate
    {

解决方案

Maybe your .csproj file was corrupted somehow?

Check to see that the entry for your file(s) look like this in your project file:

<Compile Include="BlogPost.aspx.cs">
  <DependentUpon>BlogPost.aspx</DependentUpon>
  <SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="BlogPost.aspx.designer.cs">
  <DependentUpon>BlogPost.aspx</DependentUpon>
</Compile>

这篇关于ASPX似乎无法找到code后面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆