0

I hope that someone could help me with the following problem because I'm really lost.

I get a C# HttpContext from an ajax javascript call into a C# Handler.

Then, running debug mode with VS I can see that the context.Request.Params return the following string:

id_affaire=225&Files=%3bT.00000.11-EXE-01-R+1-PL-202-B.dwg%3bT.00000.11-EXE-01-R+1-PL-202-B.dwg&table_colonne=Flexigrid_PanierBordereau&page=1&rp=10&sortname=nom&sortorder=asc&query=&qtype=&ASP.NET_SessionId=o314eh2yjush1pxno2geu42....

but doing this: context.Request.Params.Get("Files") I get the following string

;T.00000.11-EXE-01-R 1-PL-202-B.dwg;T.00000.11-EXE-01-R 1-PL-202-B.dwg

The problem is that the character + has disappeared...

 ;T.00000.11-EXE-01-R 1-PL-202-B.dwg;T.00000.11-EXE-01-R 1-PL-202-B.dwg

I'm supposed to get the full name of the file in parameter and the + should be in the R+1 string like this:

;T.00000.11-EXE-01-R+1-PL-202-B.dwg;T.00000.11-EXE-01-R+1-PL-202-B.dwg

Anyone can help me to have the string in params of the httpContext as it has been send (with the missing special char +)?

4

1 に答える 1

0

パラメータをURLに渡す前にエンコードし、context.Request.Params.Get( "Files")で取得した後、パラメータをデコードします。

次を使用できます。

HttpServerUtility.UrlDecode Method (String)
HttpServerUtility.UrlEncode Method (String)

例えば。:

エンコード

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title=" + Server.UrlEncode("ASP.NET Examples");

デコード

String DecodedString = Server.UrlDecode(EncodedString);
于 2012-09-25T10:09:04.267 に答える