Group: StrataFrame Users
Posts: 322,
Visits: 529
|
Hi all.
I am trying to use this class to encrypt and decrypt parameters being passed to a web page in the Query String.
I used this code to Encrypt the value of the pk:
I am using this code in my ListView's RowPopulating event to create an "Edit" hyperlink in the first column:
string EncrytedSignOffID = _3des.Encrypt(e.BusinessObject["sign_off_id"].ToString());
e.Values[0].DisplayValue = "<a href='EditSignOff.aspx?pk=" + EncrytedSignOffID + "&project_id=" + Request["pk"] + "'>Edit</a>";
When I click on the hyperlink to go to the Edit Page, I am trying to use this code in the Edit Page's Page_Load to decrypt the PK:
MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper _3des = new MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper();
String DecryptedSignOffID = _3des.Decrypt(Request["pk"].ToString());
But I wind up with this error instead of the web page:
System.FormatException was unhandled by user code Message=Invalid length for a Base-64 char array. Source=mscorlib StackTrace: at System.Convert.FromBase64String(String s) at MicroFour.StrataFrame.Security.Encryption.TripleDESWrapper.Decrypt(String text) at StlCI_new.EditSignOff.Page_Load(Object sender, EventArgs e) in C:\StlCI_new\StlCI_new\StlCI_new\EditSignOff.aspx.cs:line 25 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException:
Can someone help me out here? What do I need to do to make this work?
TIA.
Marcia.
|