I'm trying to do the following:
var policyBuilder = new StringBuilder();
var expiration = DateTime.UtcNow.AddDays(1).ToString("s") + "Z";
policyBuilder.AppendFormat("{ \"expiration\": \"{0}\",\n", expiration);
However, the last line throws the following exception:
An exception of type 'System.FormatException' occurred in mscorlib.dll
but was not handled in user code
Additional information: Input string was not in a correct format.
'expiration' is a string, so why am I getting this error?
Thanks