風邪ひいてたりなんだりで全然ブログ更新してませんでしたー。っと。 Angular2とASP.NET MVC"4"をお仕事でいじることになりました。 Angular2 + VisualStudio(ASP.NET MVC"4") + VisualBasic.net ニッチすぎて参考文献が少なく、VS上で動かすまでに色々と面倒くさかったのでメモ残します。 使用環境 VisualStudio2015(Update2) TypeScript(1.8.29.0) 先に参考 www.mithunvp.com dotnetspeak.com Angular2 with TypeScript using Visual Studio 2015 - CodeProject Angular2 Typescript in ASP.NET MVC Visual Studio 2015 – Russell Canfi
IIS server variables provide information about the server, the connection with the client, and the current request on the connection. IIS server variables are not the same as environment variables. Security Some server variables get their information from HTTP headers. It is recommended that you distrust information in HTTP headers because this data can be falsified by malicious users. For more de
ASP.NET MVC や Web API で、クライアントの IP アドレスを取得する方法をまとめておきます。プロキシサーバーなどを経由して Web サーバーに接続された場合、HTTP ヘッダーの X-Forwarded-For から取得する必要があります。 ASP.NET MVC サーバー環境変数から取得しているため、HTTP_X_FORWARDED_FOR がキーとなります。 #HomeController.cs public ActionResult Index() { var clientIp = ""; var xForwardedFor = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (String.IsNullOrEmpty(xForwardedFor) == false) { clientIp = xForwar
System.Web.HttpContext.Current.Request.UserHostAddress を使うとアドレス情報がIPv6で取れてしまう。 以下の方法でIPv4形式で取得可能。 ***************************** string ipa = ""; System.Net.IPHostEntry iphEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()); foreach (var ipAddr in iphEntry.AddressList) { if (ipAddr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { ipa = ipAddr.ToString(); break; } } 長い
In ASP.NET MVC, Filters are used to inject logic at different levels of request processing and allow us to share logics across Controllers. For example, let’s say we want to run a security logic or a logging logic across the controller. To do so, we’ll write a filter containing those logics and enable them across all controllers. When we enable a filter across all controllers or actions, the filte
はじめに ASP.NET Web APIのData Annotationsでリクエストモデルの値チェックをする場合、(万能ではないけれど)アクションフィルタを作ってしまった方が一々同じコードを書かなくて楽かも、という話 メソッド内に記述する POSTメソッドのリクエストに対して、URLからIDを取り、ボディをデシリアライズしてモデルにバインドする場合を例にします。 Data Annotations以外にも、nullチェックを含めて、下記のような値チェックが必要になることが多いかと思います。 public class PackageController : ApiController { public async Task<HttpResponseMessage> Post([FromUri]string id, [FromBody]PackagingRequestModel request
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く