Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はこれについてグーグルでクロールしましたが、信頼できる情報を見つけることができませんでした.
ASP.NET で画像の写真ソースを変更することの違いは何ですか?
myImage.Attributes["src"] = "/files/image1.jpg";
と
myImage.ImageUrl = "~/files/image1.jpg";
ImageUrl 属性には、アプリケーション ルートを表す ~ 文字を使用できるという利点があります。
これは、アプリケーションのルートがサブフォルダーにあり、コードでフォルダーの名前をハードコーディングする必要がない場合に役立ちます。