HttpServerUtility.UrlPathEncode メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpServerUtility.UrlPathEncode メソッドの意味・解説 

HttpServerUtility.UrlPathEncode メソッド

URL 文字列パス部分URL エンコードし、エンコードされた文字列返します

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Function UrlPathEncode ( _
    s As String _
) As String
Dim instance As HttpServerUtility
Dim s As String
Dim returnValue As String

returnValue = instance.UrlPathEncode(s)
public string UrlPathEncode (
    string s
)
public:
String^ UrlPathEncode (
    String^ s
)
public String UrlPathEncode (
    String s
)
public function UrlPathEncode (
    s : String
) : String

パラメータ

s

URL エンコードするテキスト

戻り値
URL エンコードされたテキスト

解説解説

URLエンコーディングすると、すべてのブラウザURL 文字列テキスト正常に送信しますブラウザによっては、"?"、"&"、"/"、空白などの文字切り捨てられる場合正しく表示されない場合あります。そのため、これらの文字は、<a> タグクエリ文字列ではエンコードする必要があります。これらのタグクエリ指定した文字列は、ブラウザによって要求文字列一部として送信される可能性があるためです。

UrlPathEncode は、ASP.Net Web アプリケーションから実行時に HttpUtility.UrlPathEncode メソッドアクセスするための便利な手段です。内部的にUrlPathEncodeHttpUtility.UrlPathEncode使用して文字列エンコードます。

使用例使用例

文字列URL エンコードしてからブラウザ クライアント送信するコード例次に示します。この例では、文字列 MyURL は "http%3a%2f%2fwww.contoso.com%2farticles.aspx?title = ASP.NET Examples" としてエンコードされます

Dim MyURL As String
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET
 Examples"

Response.Write( "<A HREF = " & Server.UrlPathEncode(MyURL)
 & "> ASP.NET Examples <br>")
   
String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";

Response.Write( "<A HREF = " + Server.UrlPathEncode(MyURL) +  ">
 ASP.NET Examples <br>" );
   
String myURL;
myURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";
get_Response().Write(("<A HREF = " + get_Server().UrlPathEncode(myURL)
    + "> ASP.NET Examples <br>"));
var myURL : String
myURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples"

Response.Write( "<A HREF = " + Server.UrlPathEncode(myURL) + ">
 ASP.NET Examples <br>")
   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpServerUtility クラス
HttpServerUtility メンバ
System.Web 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HttpServerUtility.UrlPathEncode メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpServerUtility.UrlPathEncode メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS