ASP.NET Web Forms の Modernization
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-[[戻る>ASP.NET の Modernization]]
* 目次 [#cb2dcf69]
#contents
*概要 [#p4222e1f]
コチラの内容をまとめた。
-Modify template : Add the Startup class to template to c...
https://github.com/OpenTouryoProject/OpenTouryo/issues/198
-Modify template : Link Bootstrap and jQuery from the tem...
https://github.com/OpenTouryoProject/OpenTouryo/issues/199
-Modify template : Correspond the JavaScript and CSS to b...
https://github.com/OpenTouryoProject/OpenTouryo/issues/200
-Modify template : Maintenance of the master page.~
https://github.com/OpenTouryoProject/OpenTouryo/issues/201
*[[共通項>ASP.NET の Modernization]] [#le39c2c1]
[[コチラ>ASP.NET の Modernization]]を参照。
*[[BundleConfig>ASP.NET の BundleConfig]] [#b48396de]
基本的な事項は、[[コチラ>ASP.NET の BundleConfig]]を参照。
**初期設定 [#s5b54b4c]
***Optimization.WebFormsをインストールする。 [#v05e2164]
[[ASP.NET Web Forms]]では、追加で以下のインストールが必要...
Install-Package Microsoft.AspNet.Web.Optimization.WebForms
***[[Web.config>#nf687ad7]]に定義を追加する。 [#y511bb29]
また、インストール後に以下の定義を[[Web.config>#nf687ad7]...
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.W...
</controls>
</pages>
</system.web>
**Bundle & Minification [#wefbae22]
以下のように、[[ASP.NET Web Forms]]用の追加の[[BundleConf...
***インストール [#neb771b9]
[[共通項>ASP.NET の Modernization]]でインストールしたパッ...
Install-Package Microsoft.AspNet.ScriptManager.MSAjax
Install-Package Microsoft.AspNet.ScriptManager.WebForms
***定義方法 [#z6ec33f3]
-定義対象
--WebFormsJs~
詳細は不明。情報が殆ど無い。
---WebForms.js
---WebUIValidation.js
---MenuStandards.js
---Focus.js
---GridView.js
---DetailsView.js
---TreeView.js
---WebParts.js
--MsAjaxJs~
JS file related to ASP.NET Ajax
---MicrosoftAjax.js
---MicrosoftAjaxApplicationServices.js
---MicrosoftAjaxTimer.js
---MicrosoftAjaxWebForms.js
-設定
--BundleConfigを追加する。~
(最新の[[ASP.NET Web Forms]]プロジェクト・テンプレートか...
public class BundleConfig
{
public static void RegisterBundles(BundleCollecti...
{
BundleTable.EnableOptimizations = true;
BundleTable.Bundles.UseCdn = true; // same as...
// ( new ScriptBundle("~/XXXX") のパスは実在...
// なので、bundlesと実在しないpathを指定して...
bundles.Add(new ScriptBundle("~/bundles/app")...
"~/Scripts/app/Site.js"));
bundles.Add(new ScriptBundle("~/bundles/otr")...
"~/Scripts/otr/common.js",
"~/Scripts/otr/ie_key_event.js",
"~/Scripts/otr/else.js"));
// こちらのCDNフォールバック設定はScriptManag...
bundles.Add(new ScriptBundle("~/bundles/WebFo...
"~/Scripts/WebForms/WebForms.js",
"~/Scripts/WebForms/WebUIValidation.j...
"~/Scripts/WebForms/MenuStandards.js",
"~/Scripts/WebForms/Focus.js",
"~/Scripts/WebForms/GridView.js",
"~/Scripts/WebForms/DetailsView.js",
"~/Scripts/WebForms/TreeView.js",
"~/Scripts/WebForms/WebParts.js"));
// こちらのCDNフォールバック設定はScriptManag...
// これらのファイルには明示的な依存関係があり...
bundles.Add(new ScriptBundle("~/bundles/MsAja...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
// 開発と学習には、Modernizr の開発バージョン...
// http://modernizr.com にあるビルド ツールを...
bundles.Add(new ScriptBundle(
"~/bundles/modernizr",
"//ajax.aspnetcdn.com/ajax/modernizr/mode...
{
CdnFallbackExpression = "window.Moder...
}.Include("~/Scripts/modernizr-*"));
ScriptManager.ScriptResourceMapping.AddDefini...
"respond",
new ScriptResourceDefinition
{
Path = "~/Scripts/respond.min.js",
DebugPath = "~/Scripts/respond.js",
CdnPath = "//ajax.aspnetcdn.com/ajax/...
CdnDebugPath = "//ajax.aspnetcdn.com/...
CdnSupportsSecureConnection = false,
LoadSuccessExpression = "window.respo...
});
}
}
-BundleConfigを呼び出す。~
Global.asax or Startup から BundleConfig.RegisterBundles...
public class Startup
{
public void Configuration(IAppBuilder app)
{
// アプリケーションの設定方法の詳細については、h...
// アプリケーションのスタートアップで実行するコ...
// URLルーティングの登録
RouteConfig.RegisterRoutes(RouteTable.Routes);
// バンドル&ミニフィケーションの登録
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
-CSSについては、Bundle.configに定義する。
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/bundles/css">
<include path="~/Content/bootstrap.css" />
<include path="~/Content/Site.css" />
</styleBundle>
</bundles>
**[[CDN>CDN(Content Delivery Network)]]フォールバック [...
***ScriptManager [#x116b8c6]
[[ASP.NET Web Forms]]ではScriptManagerにCDNフォールバック...
-アセンブリから取得する場合はCDNフォールバックの定義は不...
-以下の場合は、CDNフォールバックの定義が必要になる。
--自前のScriptManager定義を使用する場合
--CDNフォールバック動作をカスタマイズする場合
***ScriptBundle [#ef4a1813]
その他、[[ASP.NET MVC]]と同様に、ScriptBundleクラスで、~
個別にCDNフォールバックの定義を行なうこともできる。
***定義方法 [#s25dcf4f]
詳しくは、[[コチラ>https://github.com/OpenTouryoProject/O...
-[[ScriptManagerの場合>#q7b86fa2]]
-[[ScriptBundleの場合>ASP.NET の Modernization#s62820fe]]
**リンクのさせ方 [#xbdfa1a0]
[[初期設定>#s5b54b4c]]が完了していること。
***JS [#id2a0390]
Scripts.Renderメソッドと<asp:ScriptManager>タグを使用する...
-Scripts.Render
--Header
<title>・・・</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
<%: Scripts.Render("~/bundles/jquery") %>
</asp:PlaceHolder>
--Footer
<%: Scripts.Render("~/bundles/XXXX") %>
-ScriptManager
<body>
<form runat="server">
<asp:ScriptManager EnableCdn="true" runat="serve...
<Scripts>
<%--ScriptManager のバンドル スクリプト...
<%--Framework スクリプト--%>
<asp:ScriptReference Name="MsAjaxBundle"...
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" ...
<asp:ScriptReference Name="WebUIValidati...
<asp:ScriptReference Name="MenuStandards...
<asp:ScriptReference Name="GridView.js" ...
<asp:ScriptReference Name="DetailsView.j...
<asp:ScriptReference Name="TreeView.js" ...
<asp:ScriptReference Name="WebParts.js" ...
<asp:ScriptReference Name="Focus.js" Ass...
<asp:ScriptReference Name="WebFormsBundl...
<%--サイト スクリプト--%>
</Scripts>
</asp:ScriptManager>
***CSS [#f1858a71]
webopt:bundlereferenceと言うタブを使用するもよう。
<title>・・・</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/bundles/c...
**ScriptReference [#r2152a06]
***カスタマイズ [#q7b86fa2]
ScriptReferenceは、jQueryなどのファイルのバージョンと[[CD...
ただし、次のようにマッピングをカスタマイズすれば、動作を...
var mapping = ScriptManager.ScriptResourceMapping;
// Map jquery definition to the Google CDN
mapping.AddDefinition("jquery", new ScriptResourceDefini...
{
Path = "~/Scripts/jquery-2.0.0.min.js",
DebugPath = "~/Scripts/jquery-2.0.0.js",
CdnPath = "http://ajax.googleapis.com/ajax/libs/jque...
CdnDebugPath = "https://ajax.googleapis.com/ajax/lib...
CdnSupportsSecureConnection = true,
LoadSuccessExpression = "window.jQuery"
});
***ScriptBundleとの関連 [#r10bf580]
同じような疑問を持つ人がいる。
-Optimizing ScriptManager | The ASP.NET Forums~
https://forums.asp.net/t/2027312.aspx?Optimizing+ScriptMa...
-asp.net - VS2012 - Web Forms - Bundling Confusion - Stac...
http://stackoverflow.com/questions/12290537/vs2012-web-fo...
以下に回答がある。
-ASP.NET 4.5 ScriptManager Improvements in WebForms | .NE...
https://blogs.msdn.microsoft.com/webdev/2012/09/21/asp-ne...
-ASP.NET 4.5 ScriptManager Improvements in WebForms – My....
https://blogs.msdn.microsoft.com/pranav_rastogi/2012/09/2...
--MsAjaxJs
---ScriptManager
ScriptManager.ScriptResourceMapping.AddDefinition("MsAja...
{
Path = "~/bundles/MsAjaxJs",
CdnPath = "http://ajax.aspnetcdn.com/ajax/4.5/6/MsAj...
LoadSuccessExpression = "window.Sys",
CdnSupportsSecureConnection = true
});
PreApplicationStartCode.AddMsAjaxMapping("MicrosoftAjax....
---ScriptBundle
bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Inclu...
・・・
--WebFormsJs
---ScriptManager
ScriptManager.ScriptResourceMapping.AddDefinition("WebFo...
{
Path = "~/bundles/WebFormsJs",
・・・
---ScriptBundle
bundles.Add(new ScriptBundle("~/bundles/WebFormsJs").Inc...
・・・
--PreApplicationStartCode
---PreApplicationStartCode クラス (System.Web.WebPages.Ra...
https://msdn.microsoft.com/ja-jp/library/system.web.webpa...
>この型/メンバーは、.NET Framework インフラストラクチャを...
独自に作成したコードから直接使用するためのものではありま...
結論としては、
-ScriptManagerの中から、ScriptBundleを組み合わせて使って...
-PreApplicationStartCodeは、ScriptManager内部の実装であり...
ScriptManager内で[[CDNフォールバック>#s8ee8670]]も定義さ...
となる。
*[[RouteConfig>ASP.NET の RouteConfig]] [#z952e103]
基本的な事項は、[[コチラ>ASP.NET の RouteConfig]]を参照。
**機能概要 [#sfdb6d92]
[[ASP.NET Web Forms]]の[[RouteConfig>ASP.NET の RouteConf...
ファイルの拡張子(*.aspxなど)をURLに付与しなくても済むよ...
「ASP.NET Friendly URLs」と言う機能を追加できる。
**設定方法 [#d1509727]
***インストール [#g6b3e8d5]
「ASP.NET Friendly URLs」のインストール
Install-Package Microsoft.AspNet.FriendlyUrls
***定義方法 [#l0dd072e]
-RouteConfigを追加する。~
(最新の[[ASP.NET Web Forms]]プロジェクト・テンプレートか...
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection ro...
{
//var settings = new FriendlyUrlSettings();
//settings.AutoRedirectMode = RedirectMode.Perma...
//routes.EnableFriendlyUrls(settings);
}
}
-RouteConfigを呼び出す。~
Global.asax or Startup から RouteConfig.RegisterRoutesメ...
public class Startup
{
public void Configuration(IAppBuilder app)
{
// アプリケーションの設定方法の詳細については、h...
// アプリケーションのスタートアップで実行するコ...
// URLルーティングの登録
RouteConfig.RegisterRoutes(RouteTable.Routes);
// バンドル&ミニフィケーションの登録
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
*参考 [#b3a19659]
-Adding Bundling and Minification to Web Forms – RickAndM...
https://blogs.msdn.microsoft.com/rickandy/2012/08/14/addi...
**[[BundleConfig>ASP.NET の BundleConfig]] [#d735cd46]
***Bundle と Minification [#s832ac35]
-ASP.NET Web FormsでOptimizationを活用して、CSSとJavascri...
http://sianis.azurewebsites.net/?p=61
-[ASP.NET Optimization] javascript や cssのBundle と Mini...
http://www.pine4.net/Memo/Article/Archives/545
- ASP.NET 4.5 ScriptManager Improvements in WebForms | .N...
https://blogs.msdn.microsoft.com/webdev/2012/09/21/asp-ne...
***[[CDNフォールバック>#s8ee8670]] [#fce577b9]
- ASP.NET アプリの高速化 : CDN の利用とフォールバック対応...
https://blogs.msdn.microsoft.com/chack/2013/05/12/asp-net...
**[[RouteConfig>ASP.NET の RouteConfig]] [#k0869edb]
-ASP.NET Friendly URLsを使う #aspnetjp by @masaru_b_cl | ...
https://takanosho.wordpress.com/2013/12/21/one-asp-net-ad...
----
Tags: [[:.NET開発]], [[:ASP.NET]], [[:ASP.NET Web Forms]]...
終了行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-[[戻る>ASP.NET の Modernization]]
* 目次 [#cb2dcf69]
#contents
*概要 [#p4222e1f]
コチラの内容をまとめた。
-Modify template : Add the Startup class to template to c...
https://github.com/OpenTouryoProject/OpenTouryo/issues/198
-Modify template : Link Bootstrap and jQuery from the tem...
https://github.com/OpenTouryoProject/OpenTouryo/issues/199
-Modify template : Correspond the JavaScript and CSS to b...
https://github.com/OpenTouryoProject/OpenTouryo/issues/200
-Modify template : Maintenance of the master page.~
https://github.com/OpenTouryoProject/OpenTouryo/issues/201
*[[共通項>ASP.NET の Modernization]] [#le39c2c1]
[[コチラ>ASP.NET の Modernization]]を参照。
*[[BundleConfig>ASP.NET の BundleConfig]] [#b48396de]
基本的な事項は、[[コチラ>ASP.NET の BundleConfig]]を参照。
**初期設定 [#s5b54b4c]
***Optimization.WebFormsをインストールする。 [#v05e2164]
[[ASP.NET Web Forms]]では、追加で以下のインストールが必要...
Install-Package Microsoft.AspNet.Web.Optimization.WebForms
***[[Web.config>#nf687ad7]]に定義を追加する。 [#y511bb29]
また、インストール後に以下の定義を[[Web.config>#nf687ad7]...
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.W...
</controls>
</pages>
</system.web>
**Bundle & Minification [#wefbae22]
以下のように、[[ASP.NET Web Forms]]用の追加の[[BundleConf...
***インストール [#neb771b9]
[[共通項>ASP.NET の Modernization]]でインストールしたパッ...
Install-Package Microsoft.AspNet.ScriptManager.MSAjax
Install-Package Microsoft.AspNet.ScriptManager.WebForms
***定義方法 [#z6ec33f3]
-定義対象
--WebFormsJs~
詳細は不明。情報が殆ど無い。
---WebForms.js
---WebUIValidation.js
---MenuStandards.js
---Focus.js
---GridView.js
---DetailsView.js
---TreeView.js
---WebParts.js
--MsAjaxJs~
JS file related to ASP.NET Ajax
---MicrosoftAjax.js
---MicrosoftAjaxApplicationServices.js
---MicrosoftAjaxTimer.js
---MicrosoftAjaxWebForms.js
-設定
--BundleConfigを追加する。~
(最新の[[ASP.NET Web Forms]]プロジェクト・テンプレートか...
public class BundleConfig
{
public static void RegisterBundles(BundleCollecti...
{
BundleTable.EnableOptimizations = true;
BundleTable.Bundles.UseCdn = true; // same as...
// ( new ScriptBundle("~/XXXX") のパスは実在...
// なので、bundlesと実在しないpathを指定して...
bundles.Add(new ScriptBundle("~/bundles/app")...
"~/Scripts/app/Site.js"));
bundles.Add(new ScriptBundle("~/bundles/otr")...
"~/Scripts/otr/common.js",
"~/Scripts/otr/ie_key_event.js",
"~/Scripts/otr/else.js"));
// こちらのCDNフォールバック設定はScriptManag...
bundles.Add(new ScriptBundle("~/bundles/WebFo...
"~/Scripts/WebForms/WebForms.js",
"~/Scripts/WebForms/WebUIValidation.j...
"~/Scripts/WebForms/MenuStandards.js",
"~/Scripts/WebForms/Focus.js",
"~/Scripts/WebForms/GridView.js",
"~/Scripts/WebForms/DetailsView.js",
"~/Scripts/WebForms/TreeView.js",
"~/Scripts/WebForms/WebParts.js"));
// こちらのCDNフォールバック設定はScriptManag...
// これらのファイルには明示的な依存関係があり...
bundles.Add(new ScriptBundle("~/bundles/MsAja...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
"~/Scripts/WebForms/MsAjax/MicrosoftA...
// 開発と学習には、Modernizr の開発バージョン...
// http://modernizr.com にあるビルド ツールを...
bundles.Add(new ScriptBundle(
"~/bundles/modernizr",
"//ajax.aspnetcdn.com/ajax/modernizr/mode...
{
CdnFallbackExpression = "window.Moder...
}.Include("~/Scripts/modernizr-*"));
ScriptManager.ScriptResourceMapping.AddDefini...
"respond",
new ScriptResourceDefinition
{
Path = "~/Scripts/respond.min.js",
DebugPath = "~/Scripts/respond.js",
CdnPath = "//ajax.aspnetcdn.com/ajax/...
CdnDebugPath = "//ajax.aspnetcdn.com/...
CdnSupportsSecureConnection = false,
LoadSuccessExpression = "window.respo...
});
}
}
-BundleConfigを呼び出す。~
Global.asax or Startup から BundleConfig.RegisterBundles...
public class Startup
{
public void Configuration(IAppBuilder app)
{
// アプリケーションの設定方法の詳細については、h...
// アプリケーションのスタートアップで実行するコ...
// URLルーティングの登録
RouteConfig.RegisterRoutes(RouteTable.Routes);
// バンドル&ミニフィケーションの登録
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
-CSSについては、Bundle.configに定義する。
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/bundles/css">
<include path="~/Content/bootstrap.css" />
<include path="~/Content/Site.css" />
</styleBundle>
</bundles>
**[[CDN>CDN(Content Delivery Network)]]フォールバック [...
***ScriptManager [#x116b8c6]
[[ASP.NET Web Forms]]ではScriptManagerにCDNフォールバック...
-アセンブリから取得する場合はCDNフォールバックの定義は不...
-以下の場合は、CDNフォールバックの定義が必要になる。
--自前のScriptManager定義を使用する場合
--CDNフォールバック動作をカスタマイズする場合
***ScriptBundle [#ef4a1813]
その他、[[ASP.NET MVC]]と同様に、ScriptBundleクラスで、~
個別にCDNフォールバックの定義を行なうこともできる。
***定義方法 [#s25dcf4f]
詳しくは、[[コチラ>https://github.com/OpenTouryoProject/O...
-[[ScriptManagerの場合>#q7b86fa2]]
-[[ScriptBundleの場合>ASP.NET の Modernization#s62820fe]]
**リンクのさせ方 [#xbdfa1a0]
[[初期設定>#s5b54b4c]]が完了していること。
***JS [#id2a0390]
Scripts.Renderメソッドと<asp:ScriptManager>タグを使用する...
-Scripts.Render
--Header
<title>・・・</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
<%: Scripts.Render("~/bundles/jquery") %>
</asp:PlaceHolder>
--Footer
<%: Scripts.Render("~/bundles/XXXX") %>
-ScriptManager
<body>
<form runat="server">
<asp:ScriptManager EnableCdn="true" runat="serve...
<Scripts>
<%--ScriptManager のバンドル スクリプト...
<%--Framework スクリプト--%>
<asp:ScriptReference Name="MsAjaxBundle"...
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" ...
<asp:ScriptReference Name="WebUIValidati...
<asp:ScriptReference Name="MenuStandards...
<asp:ScriptReference Name="GridView.js" ...
<asp:ScriptReference Name="DetailsView.j...
<asp:ScriptReference Name="TreeView.js" ...
<asp:ScriptReference Name="WebParts.js" ...
<asp:ScriptReference Name="Focus.js" Ass...
<asp:ScriptReference Name="WebFormsBundl...
<%--サイト スクリプト--%>
</Scripts>
</asp:ScriptManager>
***CSS [#f1858a71]
webopt:bundlereferenceと言うタブを使用するもよう。
<title>・・・</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/bundles/c...
**ScriptReference [#r2152a06]
***カスタマイズ [#q7b86fa2]
ScriptReferenceは、jQueryなどのファイルのバージョンと[[CD...
ただし、次のようにマッピングをカスタマイズすれば、動作を...
var mapping = ScriptManager.ScriptResourceMapping;
// Map jquery definition to the Google CDN
mapping.AddDefinition("jquery", new ScriptResourceDefini...
{
Path = "~/Scripts/jquery-2.0.0.min.js",
DebugPath = "~/Scripts/jquery-2.0.0.js",
CdnPath = "http://ajax.googleapis.com/ajax/libs/jque...
CdnDebugPath = "https://ajax.googleapis.com/ajax/lib...
CdnSupportsSecureConnection = true,
LoadSuccessExpression = "window.jQuery"
});
***ScriptBundleとの関連 [#r10bf580]
同じような疑問を持つ人がいる。
-Optimizing ScriptManager | The ASP.NET Forums~
https://forums.asp.net/t/2027312.aspx?Optimizing+ScriptMa...
-asp.net - VS2012 - Web Forms - Bundling Confusion - Stac...
http://stackoverflow.com/questions/12290537/vs2012-web-fo...
以下に回答がある。
-ASP.NET 4.5 ScriptManager Improvements in WebForms | .NE...
https://blogs.msdn.microsoft.com/webdev/2012/09/21/asp-ne...
-ASP.NET 4.5 ScriptManager Improvements in WebForms – My....
https://blogs.msdn.microsoft.com/pranav_rastogi/2012/09/2...
--MsAjaxJs
---ScriptManager
ScriptManager.ScriptResourceMapping.AddDefinition("MsAja...
{
Path = "~/bundles/MsAjaxJs",
CdnPath = "http://ajax.aspnetcdn.com/ajax/4.5/6/MsAj...
LoadSuccessExpression = "window.Sys",
CdnSupportsSecureConnection = true
});
PreApplicationStartCode.AddMsAjaxMapping("MicrosoftAjax....
---ScriptBundle
bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Inclu...
・・・
--WebFormsJs
---ScriptManager
ScriptManager.ScriptResourceMapping.AddDefinition("WebFo...
{
Path = "~/bundles/WebFormsJs",
・・・
---ScriptBundle
bundles.Add(new ScriptBundle("~/bundles/WebFormsJs").Inc...
・・・
--PreApplicationStartCode
---PreApplicationStartCode クラス (System.Web.WebPages.Ra...
https://msdn.microsoft.com/ja-jp/library/system.web.webpa...
>この型/メンバーは、.NET Framework インフラストラクチャを...
独自に作成したコードから直接使用するためのものではありま...
結論としては、
-ScriptManagerの中から、ScriptBundleを組み合わせて使って...
-PreApplicationStartCodeは、ScriptManager内部の実装であり...
ScriptManager内で[[CDNフォールバック>#s8ee8670]]も定義さ...
となる。
*[[RouteConfig>ASP.NET の RouteConfig]] [#z952e103]
基本的な事項は、[[コチラ>ASP.NET の RouteConfig]]を参照。
**機能概要 [#sfdb6d92]
[[ASP.NET Web Forms]]の[[RouteConfig>ASP.NET の RouteConf...
ファイルの拡張子(*.aspxなど)をURLに付与しなくても済むよ...
「ASP.NET Friendly URLs」と言う機能を追加できる。
**設定方法 [#d1509727]
***インストール [#g6b3e8d5]
「ASP.NET Friendly URLs」のインストール
Install-Package Microsoft.AspNet.FriendlyUrls
***定義方法 [#l0dd072e]
-RouteConfigを追加する。~
(最新の[[ASP.NET Web Forms]]プロジェクト・テンプレートか...
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection ro...
{
//var settings = new FriendlyUrlSettings();
//settings.AutoRedirectMode = RedirectMode.Perma...
//routes.EnableFriendlyUrls(settings);
}
}
-RouteConfigを呼び出す。~
Global.asax or Startup から RouteConfig.RegisterRoutesメ...
public class Startup
{
public void Configuration(IAppBuilder app)
{
// アプリケーションの設定方法の詳細については、h...
// アプリケーションのスタートアップで実行するコ...
// URLルーティングの登録
RouteConfig.RegisterRoutes(RouteTable.Routes);
// バンドル&ミニフィケーションの登録
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
*参考 [#b3a19659]
-Adding Bundling and Minification to Web Forms – RickAndM...
https://blogs.msdn.microsoft.com/rickandy/2012/08/14/addi...
**[[BundleConfig>ASP.NET の BundleConfig]] [#d735cd46]
***Bundle と Minification [#s832ac35]
-ASP.NET Web FormsでOptimizationを活用して、CSSとJavascri...
http://sianis.azurewebsites.net/?p=61
-[ASP.NET Optimization] javascript や cssのBundle と Mini...
http://www.pine4.net/Memo/Article/Archives/545
- ASP.NET 4.5 ScriptManager Improvements in WebForms | .N...
https://blogs.msdn.microsoft.com/webdev/2012/09/21/asp-ne...
***[[CDNフォールバック>#s8ee8670]] [#fce577b9]
- ASP.NET アプリの高速化 : CDN の利用とフォールバック対応...
https://blogs.msdn.microsoft.com/chack/2013/05/12/asp-net...
**[[RouteConfig>ASP.NET の RouteConfig]] [#k0869edb]
-ASP.NET Friendly URLsを使う #aspnetjp by @masaru_b_cl | ...
https://takanosho.wordpress.com/2013/12/21/one-asp-net-ad...
----
Tags: [[:.NET開発]], [[:ASP.NET]], [[:ASP.NET Web Forms]]...
ページ名: