GVKun编程网logo

ASP.NET CodeFileBaseClass属性与从System.Web.UI.Page继承(.net中class和struct)

16

关于ASP.NETCodeFileBaseClass属性与从System.Web.UI.Page继承和.net中class和struct的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于an

关于ASP.NET CodeFileBaseClass属性与从System.Web.UI.Page继承.net中class和struct的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android – NoClassDefFoundError:com.google.firebase.perf.internal.RemoteConfigManager、Asp.net System.Web.HttpContext.Current.Session null in global.asax、ASP.NET web.config:system.web.compilation中的debug属性的默认值是什么?、asp.net – aspnet_compiler找到错误版本的System.Web.WebPages 1.0.0.0而不是2.0.0.0等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

ASP.NET CodeFileBaseClass属性与从System.Web.UI.Page继承(.net中class和struct)

ASP.NET CodeFileBaseClass属性与从System.Web.UI.Page继承(.net中class和struct)

我刚从System.Web.UI.Page继承为我的页面创建了一个基类:

public abstract class PageBase : System.Web.UI.Page
{
    ...
}

当我注意到你也可以在ASP.NET视图中声明一个基页:

<%@ Page Language="C#" CodeFileBaseCodeFile="page.aspx.cs"
    Inherits="page" %>

有人可以解释一种方法的优点和缺点是什么吗?你什么时候使用一个,或者它们都是一样的?如果你同时使用两者会怎么样?

解决方法

CodeFileBlassClass,CodeFile,继承与继承一起工作,而不是继承.

例如,指定CodeFile =“page.aspx.cs”而不存在page.aspx.cs将导致:

Parser Error Message: The file '/page.aspx.cs' does not exist.

假设存在page.aspx.cs,则指定CodeFileBaseClass =“PageBase.cs”而不存在PageBase.cs将导致:

Parser Error Message: Could not load type 'PageBase.cs'.

另一方面,您可以从PageBase继承而不指定CodeFileBaseClass属性.但是,当从基类引用页面上的控件时,这可能会导致意外行为.

引用Microsoft’s @Page MSDN Documentation:

CodeFileBaseClass
Specifies the type name of a base class for a page and its associated code-behind class. This attribute is optional,but when it is used the
CodeFile attribute must also be present. Use this attribute when you want to implement a shared scenario,where you define common
fields (and optionally,associated events) in a base class to
reference the controls declared in a Web page. Because of the ASP.NET
code generation model,if you defined the fields in a base class
without using this attribute,at compile time new member deFinitions
would be generated for the controls declared in the Web page (within a
separate partial class stub),and your desired scenario would not
work. But if you use the CodeFileBaseClass attribute to associate
the base class with the page,and you make your partial class (its
name is assigned to the Inherits attribute and its source file is
referenced by the CodeFile attribute) inherit from the base class,then the fields in the base class will be able to reference the controls on the page after code generation.

android – NoClassDefFoundError:com.google.firebase.perf.internal.RemoteConfigManager

android – NoClassDefFoundError:com.google.firebase.perf.internal.RemoteConfigManager

我开始在Fabric上遇到以下问题:

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$3.done(AsyncTask.java:309)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
       at java.util.concurrent.FutureTask.run(FutureTask.java:242)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)


Caused by java.lang.NoClassDefFoundError: com.google.firebase.perf.internal.RemoteConfigManager
       at com.google.firebase.perf.internal.FeatureControl.Nown Source:2)
       at com.google.firebase.perf.internal.FeatureControl.zzar(UnkNown Source:10)
       at com.google.firebase.perf.internal.GaugeManager.Nown Source:4)
       at com.google.firebase.perf.internal.GaugeManager.zzbf(UnkNown Source:22)
       at com.google.android.gms.internal.firebase-perf.zzat.Nown Source:2)
       at com.google.android.gms.internal.firebase-perf.zzat.zza(UnkNown Source:1)
       at com.google.firebase.perf.network.FirebasePerfUrlConnection.instrument(UnkNown Source:9)
       at io.branch.referral.network.BranchRemoteInterfaceUrlConnection.doRestfulPost(BranchRemoteInterfaceUrlConnection.java:127)
       at io.branch.referral.network.BranchRemoteInterfaceUrlConnection.doRestfulPost(BranchRemoteInterfaceUrlConnection.java:45)
       at io.branch.referral.network.BranchRemoteInterface.make_restful_post(BranchRemoteInterface.java:136)
       at io.branch.referral.Branch$BranchPostTask.doInBackground(Branch.java:2860)
       at io.branch.referral.Branch$BranchPostTask.doInBackground(Branch.java:2835)
       at android.os.AsyncTask$2.call(AsyncTask.java:295)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

使用以下配置:

在根build.gradle上

classpath 'com.google.gms:google-services:4.1.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'

并在应用程序build.gradle中

apply plugin: 'com.google.firebase.firebase-perf'

...

api 'com.android.support:multidex:1.0.3'

implementation "com.google.firebase:firebase-core:16.0.6"
implementation "com.google.firebase:firebase-inappmessaging-display:17.0.4"
implementation "com.google.firebase:firebase-perf:16.2.2"
implementation "com.google.android.gms:play-services-gcm:16.0.0"
implementation "com.google.android.gms:play-services-analytics:16.0.6"

...

apply plugin: 'com.google.gms.google-services'

有人知道工作配置或修复方法吗?
这种崩溃率很高.

Devices distribution for the crash

最佳答案
看起来这是谷歌的一个已知问题,他们正在努力修复它:

请查看此链接以获取更多详细信息:https://groups.google.com/forum/#!topic/firebase-talk/7Ccu-Zh8pdg

我的解决方法是降级库版本,低于适合我的配置:

'com.android.support:multidex:1.0.3'
"com.google.firebase:firebase-core:15.0.2"
"com.google.firebase:firebase-perf:15.0.0"
"com.google.android.gms:play-services-gcm:15.0.1"

我希望有所帮助!

Asp.net System.Web.HttpContext.Current.Session null in global.asax

Asp.net System.Web.HttpContext.Current.Session null in global.asax

我有一个自定义安全主体对象,我在global.asax中为当前线程设置,一切都很好,没有问题.

但是,我只是添加一个动态图像功能,让一个页面提供图像,每当加载动态图像页面System.Web.HttpContext.Current.Session是null在global.asax,这阻止我设置安全校长是从那时开始的正常和级联问题.

通常,在用户登录时,在开始时的会话期间,global.asax中的Session仅为null,之后它始终可用于此单个异常.

当浏览器碰到原始页面中的图像时,加载动态图像页面,即

我猜这是浏览器在不发送一些凭据的情况下请求该页面的一个方面呢?

任何帮助将不胜感激.

解决方法

约翰,

我假设你正在为处理程序使用一个ashx处理程序.如果是这样,请务必从IRequiresSessionState派生例如:

public class Images : IHttpHandler,System.Web.SessionState.IRequiresSessionState
{ }

如果您不使用ashx,您可以描述动态图像页面的意思吗?

玩笑

ASP.NET web.config:system.web.compilation中的debug属性的默认值是什么?

ASP.NET web.config:system.web.compilation中的debug属性的默认值是什么?

如果我不在编译元素中包括debug属性,如下所示:
<system.web>
    <compilation />
</system.web>

它默认为true或false?将赞赏链接到来源。

解决方法

编译中debug属性的默认值为false

MSDN – compilation Element (ASP.NET Settings Schema)

debug

Optional Boolean attribute. Specifies whether to compile debug binaries rather than retail binaries. The default is False.

asp.net – aspnet_compiler找到错误版本的System.Web.WebPages 1.0.0.0而不是2.0.0.0

asp.net – aspnet_compiler找到错误版本的System.Web.WebPages 1.0.0.0而不是2.0.0.0

我有一个ASP.NET MVC4项目,编译精细VS2010。为了部署目的,我运行一个Nant脚本,试图使用aspnet_compiler.exe预编译网站,但我一直运行到一个程序集引用问题与System.Web.WebPage

error CS1705: Assembly ‘System.Web.Mvc,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35’ uses ‘System.Web.WebPages,Version=2.0.0.0,PublicKeyToken=31bf3856ad364e35’ which has a higher version than referenced assembly ‘System.Web.WebPages,Version=1.0.0.0,PublicKeyToken=31bf3856ad364e35’

我还在我的web.config中有以下程序集绑定:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

和我的csproj有以下参考:

<Reference Include="System.Web.WebPages,PublicKeyToken=31bf3856ad364e35">
  <Private>True</Private>
 <HintPath>..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>

解决方法

我通过在Web.config中明确引用2.0程序集来解决这个问题。我想由于某种原因,ASP.NET编译器(在我的情况下,当运行MvcBuildViews),使用旧的1.0程序集,如果找到。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- … -->
  <system.web>
    <!-- … -->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Mvc,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL" />
        <add assembly="System.Web.Abstractions,PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing,PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages,processorArchitecture=MSIL" />
      </assemblies>
    </compilation>
    <!-- … -->
  </system.web>
  <!-- … -->
</configuration>

BTW:看起来这个问题发生在我第一次添加第三方ASP.NET MVC 3.0组件后。该组件通过程序集绑定工作正常,但它可能是为什么ASP.NET编译器尝试首先加载1.0网页的原因。

关于ASP.NET CodeFileBaseClass属性与从System.Web.UI.Page继承.net中class和struct的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android – NoClassDefFoundError:com.google.firebase.perf.internal.RemoteConfigManager、Asp.net System.Web.HttpContext.Current.Session null in global.asax、ASP.NET web.config:system.web.compilation中的debug属性的默认值是什么?、asp.net – aspnet_compiler找到错误版本的System.Web.WebPages 1.0.0.0而不是2.0.0.0等相关知识的信息别忘了在本站进行查找喔。

本文标签: