I have a guid value that I store in my hidden variable. e.g. (303427ca-2a5c-df11-a391-005056b73dd7)
Now how do I convert the value from this hidden field back to the GUID value (because the method I would call expects the GUID value).
thanks.
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 do this quite easily on an attacker by storing the guid in a string. It is trivial to find, say, a page file. Keep it in the Guide and kill two birds with one stone.
string strGuid; strGuid = (your guid here); Guid guid = new Guid(strGuid);
For more information, MSDN
Guid has a constructor for string guides.
Guid guid = new Guid(myStringGuid);
new Guid (myHiddenFieldString)
I think this can be done simply as follows:
Guid MyGuid = new Guid(stringValue);
In .NET4, you can also use:
Guid myGuid = Guid.Parse(myGuidString);
Just a coding issue, but some people find it more intuitive.
Source: https://habr.com/ru/post/1309414/More articles:#include - brackets against quotes in Xcode? - c ++How to get the image (its position) in focus in the image gallery? - androidLINQ to SQL - formatting a string before saving? - stringCPS / Continuations StackOverflowError on (tail-) recursive functions - scalaHow to execute a query with an IN clause in spring? - javabackground thread exception handling using thread pool - multithreadingsHow to determine the path to the current website - vb.nethiding inner class implementation using namespace - c ++mysql query clarification - sqlIs it possible to remove duplicate value from datatable in C #? - c #All Articles