This is a migrated thread and some comments may be shown as answers.

RadWindow and Encrypted URL Parameters

5 Answers 63 Views
Window
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 26 Oct 2011, 04:48 PM
Hi Everyone,

I am launching RadWindows from context menus associated with TreeViews and Grids.  For performance reasons, I would like to launch those RadWindows via JavaScript.

My problem is that my application is a consumer application, so security is an issue.  Thus, my URL parameters must be encrypted.  As far as I know, there is no "good" way to (1) encrypt URL parameters via JavaScript or (2) set session variables via JavaScript.  

I am writing to see if anyone has developed a "slick" way to handle this problem.  All of the solutions that I have thought of are ugly.

Thanks!

Jim

P.S.  Side note, launching RadWindows from the server is not my desired solution.  In this app, I need to cut out the time cost of postbacks, etc, as much as possible.  Thanks!

5 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 27 Oct 2011, 02:01 PM
Hello James,

You could use a callback to pass in the parameters you want encrypted and on the server it can encrypt the value and return the encrypted value so you can use it in your js function to open the RadWindow. So it would look something like this:

Code-Behind (C#):
public partial class _Default : System.Web.UI.Page, ICallbackEventHandler
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
  
    // hold callback return value
    string returnValue;
  
    public string GetCallbackResult()
    {
        return returnValue;
    }
  
    public void RaiseCallbackEvent(string args)
    {
              // encrypt whatever is passed to args and pass to returnValue
              returnValue = Encrypt(args);
    }
}

JS:
function OpenRadWindowWithEncryptedParams(arg) {
            try
                      // call callback
                <%=Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveResult", "null") %>;
            }
            catch (e) {
            }
        }
        function ReceiveHitResult(value) {
            var oWnd = $find("<%=RadWindow1.ClientID%>")
            oWnd.setUrl("Page1.aspx?query=" + value);
            oWnd.show();
        }

I hope that helps.
0
James
Top achievements
Rank 1
answered on 27 Oct 2011, 04:39 PM
Kevin,

That looks pretty slick.  I haven't dug into it much yet, but a quick glance makes me think it will work perfect for what I need to do here.

Thank you VERY much!

I will report back on how it goes when I get back to coding this.

Jim
0
James
Top achievements
Rank 1
answered on 27 Oct 2011, 05:25 PM
I think I am getting close to having this work, but I am not yet that good at JavaScript.  I am getting this error:

Compiler Error Message: BC30451: 'this' is not declared. It may be inaccessible due to its protection level.

Source Error:

Line 42:             try { 
Line 43:                       // call callback
Line 44:                 <%=Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveResult", "null") %>;
Line 45:             }
Line 46:             catch (e) {


Any suggestions?

Thank you so much!
0
Kevin
Top achievements
Rank 2
answered on 27 Oct 2011, 07:11 PM
Hello James,

You are using C# right? I don't see why it would throw an error on the this keyword. The VB equivalent is Me. If you are using C#, if you could post what your page markup looks like.
0
James
Top achievements
Rank 1
answered on 27 Oct 2011, 07:40 PM
Kevin,

Sorry.  I was coding in VB.  And I know that about the "this."  I just wasn't thinking.

This procedure is working great.  :)  Thank you so, so much.  I was struggling with this.

Thanks,

Jim
Tags
Window
Asked by
James
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
James
Top achievements
Rank 1
Share this question
or