Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何获得;Guid";ASP.NET中http头中的变量_C#_Asp.net_Http_Header_Guid - Fatal编程技术网

C# 如何获得;Guid";ASP.NET中http头中的变量

C# 如何获得;Guid";ASP.NET中http头中的变量,c#,asp.net,http,header,guid,C#,Asp.net,Http,Header,Guid,下一行给出错误(无法将类型“string”转换为“System.Guid”) 是否有任何解决方案可以在http标头Get中传递Guid变量 try { userId = new Guid(Request.QueryString["id"]); } catch (FormatException e) { /* * It's possible that the guid is not properly formatted and an * exception wi

下一行给出错误(无法将类型“string”转换为“System.Guid”)

是否有任何解决方案可以在http标头Get中传递Guid变量

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.
     */
}
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.
     */
}