i have a guid value that i store in my hidden variable. say for eg (303427ca-2a5c-df11-a391-005056b73dd7)
now how do i convert the value from thi开发者_Python百科s hidden field back to GUID value (because the method i would be calling expects a GUID value).
thank you.
Just use the overloaded constructor:
try
{
  Guid guid = new Guid("{D843D80B-F77D-4655-8A3E-684CC35B26CB}");
}
catch (Exception ex) // There might be a more appropriate exception to catch
{
  // Do something here in case the parsing fails.
}
You are making it pretty easy on an attacker by storing the Guid in a string. Trivial to find back in, say, the paging file. Store it in a Guid and kill two birds with one stone.
    string strGuid;
    strGuid = (your guid here);
    Guid guid = new Guid(strGuid);
For more info, MSDN
Guid has a constructor for string Guids.
Guid guid = new Guid(myStringGuid);
new Guid(myHiddenFieldString)
I think it can be done simply as following:
Guid MyGuid = new Guid(stringValue);
In .NET4 onwards you can also use:
Guid myGuid = Guid.Parse(myGuidString); 
Just a matter of coding preference, but some people find this more intuitive.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论