It shows me the error that id should be 4 hyphen 32 bit. How can I solve this problem?
<pre> if (!Page.IsPostBack)
{
// Guid gd = new Guid(userID);
Guid userID;
userID = new Guid(Request.QueryString["ID"]);
MembershipUser user = Membership.GetUser(userID);
user.IsApproved = true;
Roles.AddUserToRole(user.ToString(), "Power Users");
Membership.UpdateUser(user);
ActiviationNameLabel.Text = user.UserName;
ActivationCreationDateLabel.Text = user.CreationDate.ToShortDateString();
if (user.IsApproved)
{
ActivationStatusLabel.Text = "Active";
}
else
{
ActivationStatusLabel.Text = "Pending";
}
}
//}
//catch
//{
//}
}
</pre>
error is
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Source Error:
Line 28:
Line 29: Guid userID;
Line 30: userID = new Guid(Request.Params["ID"]);
Line 31:
Line 32: MembershipUser user = Membership.GetUser(userID);
Source File: c:\Documents and Settings\Pennar\Desktop\Workspace\activate.aspx.cs Line: 30
Stack Trace:
[FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).]
System.Guid..ctor(String g) +2486
activate.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Pennar\Desktop\Workspace\activate.aspx.cs:30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Thanks in advance!