0

次の行でエラーが発生します (型 "string" を "System.Guid" に変換できません)。

userId = Request.QueryString["id"];

httpヘッダーGetでGuid変数を渡す解決策はありますか?

4

1 に答える 1

3
try {
    userId = new Guid(Request.QueryString["id"]);
} catch (FormatException e) {
    /*
     * It's possible that the guid is not properly formatted and an
     * exception will be thrown, so handle that here.
     */
}
于 2009-01-29T05:43:57.320 に答える