RadWindow and Encrypted URL Parameters

6 posts, 0 answers
  1. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 26 Oct 2011 Link to this post

    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!
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 27 Oct 2011 Link to this post

    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.
  3. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 27 Oct 2011 Link to this post

    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
  4. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 27 Oct 2011 Link to this post

    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!
  5. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 27 Oct 2011 Link to this post

    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.
  6. James
    James avatar
    55 posts
    Member since:
    Oct 2011

    Posted 27 Oct 2011 Link to this post

    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
Back to Top