在 ASP.NET 中使用旧应用程序时 web.config 存在疑问

发布于 2024-10-28 12:53:37 字数 4750 浏览 7 评论 0原文

在旧应用程序上使用 ASP.NET 2.0 C# 进行编码。数据库位于 MySQL 中,

我想知道如果我从代码中删除以下行,是否会出现任何问题

首先

然后,

  <compilers>
      <compiler language="c#" 
              type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" 
              extension=".cs" 
              compilerOptions="/d:DEBUG;trACE"/>
  </compilers>

最后,

    <browserCaps>
        <case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))?">
            browser=Gecko
            <filter>
                <case match="(Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))">
                    type=${type}
                </case>
                <case>
                    <!-- plain Mozilla if no VendorProductToken found -->
                    type=Mozilla
                </case>
            </filter>
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
            <case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
                version=${version}
                majorversion=0${major}
                minorversion=0${minor}
                <case match="^b" with="${letters}">
                    beta=true
                </case>
            </case>
        </case>
        <!-- AppleWebKit Based Browsers (Safari...) //-->
        <case match="AppleWebKit/(?'version'(?'major'\d?)(?'minor'\d{2})(?'letters'\w*)?)">
            browser=AppleWebKit
            version=${version}
            majorversion=0${major}
            minorversion=0.${minor}
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
            <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))(.* )?(?'type'[^/\d]*)/.*( |$)">
                type=${type}
            </case>
        </case>
        <!-- Konqueror //-->
        <case match=".+[K|k]onqueror/(?'version'(?'major'\d+)(?'minor'(\.[\d])*)(?'letters'[^;]*));\s+(?'platform'[^;\)]*)(;|\))">
            browser=Konqueror
            version=${version}
            majorversion=0${major}
            minorversion=0${minor}
            platform=${platform}
            type=Konqueror
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
        </case>
        <!-- Opera //-->
        <case match="Opera[ /](?'version'(?'major'\d+)(?'minor'\.(?'minorint'\d+))(?'letters'\w*))">
            <filter match="[7-9]" with="${major}">
                tagwriter=System.Web.UI.HtmlTextWriter
            </filter>
            <filter>
                <case match="7" with="${major}">
                    <filter>
                        <case match="[5-9]" with="${minorint}">
                            ecmascriptversion=1.5
                        </case>
                        <case>
                            ecmascriptversion=1.4
                        </case>
                    </filter>
                </case>
                <case match="[8-9]" with="${major}">
                    ecmascriptversion=1.5
                </case>
            </filter>
        </case>
    </browserCaps>

我相信它们全部不需要。目前是否需要它们?我真正想知道的是,如果我删除它们,是否会出现任何问题。

我还想知道

  <sessionState mode="InProc" 
              stateConnectionString="tcpip=127.0.0.1:42424" 
              sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" 
              cookieless="false" 
              timeout="100"/>

当我的应用程序使用 MySQL 作为数据库且身份验证模式为 Windows 时,下面给出的代码片段是否与 ASP.NET 2.0 相关。

Coding with ASP.NET 2.0 C# on a legacy application. The database is in MySQL

I would like to know whether anything breaks if I delete the following lines from my code

First <xhtmlConformance mode="Strict"/>

Then,

  <compilers>
      <compiler language="c#" 
              type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" 
              extension=".cs" 
              compilerOptions="/d:DEBUG;trACE"/>
  </compilers>

And last,

    <browserCaps>
        <case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))?">
            browser=Gecko
            <filter>
                <case match="(Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))">
                    type=${type}
                </case>
                <case>
                    <!-- plain Mozilla if no VendorProductToken found -->
                    type=Mozilla
                </case>
            </filter>
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
            <case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
                version=${version}
                majorversion=0${major}
                minorversion=0${minor}
                <case match="^b" with="${letters}">
                    beta=true
                </case>
            </case>
        </case>
        <!-- AppleWebKit Based Browsers (Safari...) //-->
        <case match="AppleWebKit/(?'version'(?'major'\d?)(?'minor'\d{2})(?'letters'\w*)?)">
            browser=AppleWebKit
            version=${version}
            majorversion=0${major}
            minorversion=0.${minor}
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
            <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))(.* )?(?'type'[^/\d]*)/.*( |$)">
                type=${type}
            </case>
        </case>
        <!-- Konqueror //-->
        <case match=".+[K|k]onqueror/(?'version'(?'major'\d+)(?'minor'(\.[\d])*)(?'letters'[^;]*));\s+(?'platform'[^;\)]*)(;|\))">
            browser=Konqueror
            version=${version}
            majorversion=0${major}
            minorversion=0${minor}
            platform=${platform}
            type=Konqueror
            frames=true
            tables=true
            cookies=true
            javascript=true
            javaapplets=true
            ecmascriptversion=1.5
            w3cdomversion=1.0
            css1=true
            css2=true
            xml=true
            tagwriter=System.Web.UI.HtmlTextWriter
        </case>
        <!-- Opera //-->
        <case match="Opera[ /](?'version'(?'major'\d+)(?'minor'\.(?'minorint'\d+))(?'letters'\w*))">
            <filter match="[7-9]" with="${major}">
                tagwriter=System.Web.UI.HtmlTextWriter
            </filter>
            <filter>
                <case match="7" with="${major}">
                    <filter>
                        <case match="[5-9]" with="${minorint}">
                            ecmascriptversion=1.5
                        </case>
                        <case>
                            ecmascriptversion=1.4
                        </case>
                    </filter>
                </case>
                <case match="[8-9]" with="${major}">
                    ecmascriptversion=1.5
                </case>
            </filter>
        </case>
    </browserCaps>

I believe they all are not needed. Are they needed at all at present? What I would really like to know is whether anything breaks if I delete them.

I would also like to know whether the snippet given below is relevant for ASP.NET 2.0

  <sessionState mode="InProc" 
              stateConnectionString="tcpip=127.0.0.1:42424" 
              sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" 
              cookieless="false" 
              timeout="100"/>

when my application is using MySQL as database and authentication mode is windows.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉城 2024-11-04 12:53:37

xhtmlConformance 设置将 Transitional 更改为 Strict。主要变化是从表单元素中删除了 name 属性。 来源

指定的编译器是2.0,所以不会有任何实际的编译器更改。但是,编译定义了编译器标志调试和跟踪。这些可以与#if 语句一起使用。两者都应该在生产环境中删除,就像您将使用 .请注意,编译器设置应位于 system.codeDom 下,而不是 system.web 下。 来源

您的 browserCaps 可以(应该? )被移动到您的 App_Browsers 文件夹中。您基本上定义了不同浏览器的功能,并且在代码中的某个位置会检查您的浏览器是否支持特定的细节,例如 javascript 或框架。这会失败,因为像 Noscript 这样的浏览器插件会使检测无效。

您的 sessionState 声称是 InProc,这意味着它由 iis 进程处理。此模式中不使用连接字符串(您需要 StateServer 或 SqlServer)。 Cookieless=false 是默认模式,但您已将会话超时增加到 100(默认为 20)。 来源

The xhtmlConformance setting changes Transitional to Strict. The primary change is that the name attribute is removed from form elements. Source

The compiler specified is 2.0, so there wont be any actual compiler change. However, compilation defines both the compiler flags debug and trace. These can be used with #if-statements. Both should be removed in production environment, just as you will use . Notice that the compiler settings should be under system.codeDom, not system.web. Source

Your browserCaps could (should?) be moved into your App_Browsers folder. You basically defined capabilities of different browsers, and somewhere in your code there are checks if your browser supports specific details, like javascript or frames. This fails bigtime, since browser addons like Noscript will make the detection invalid.

Your sessionState claims to be InProc, which means its handled by the iis process. The connection strings aint used in this mode (you need StateServer or SqlServer for that). Cookieless=false is the default mode, but you've increased the session timeout to 100 (from default 20). Source

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文