Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Cross Page Posting - Passing paramsCross Page Posting - Passing params
Previous
 
Next
New Post
1/14/2010 11:21 AM
 

 Hello All,

Using DNN 5.1.4 (soon to upgrade to 5.2.x)

I am in the middle of building an app and I am at the point where a user will select a record from a grid and then click a button to view further details of that particular record.  Here is the code that works well for me.

You can see the code below that works well, it open a new page, using the second control within the module.  In the response.redirect,  you can see that I call the ascx contol and pass along a few params, including a key, which I then use to filter the next set of data.  The code below generates a long URL that does not look good and is not secure - not even slightly secure.

My question is what is the best, or even better, way to do this.  It works as it is currently written, but anyone can change the URL and  immediately they see the data of the edited URL.  On reading my general asp.net book, I have read about PreviousPage  property.  Is that what I should be using?  Does anyone have any examples of how to use this?

Thanks in advance for your assistance.

Mark Breen

Ireland

Here is the code that works, but I want to improve the URL

 

protected void cbViewDates_Click(object sender, EventArgs e)

        {

            GridDataItem gridDataItem = (GridDataItem)RadGrid1.SelectedItems[0];

            String key = gridDataItem["Id"].Text;

            

            string[] additionalParams = new string[2];


            additionalParams[0] = "OrganisationName=" + HttpUtility.UrlEncode(gridDataItem["OrganisationName"].Text);

            additionalParams[1] = "CourseName=" + HttpUtility.UrlEncode(gridDataItem["CourseName"].Text);

                      


            Response.Redirect(EditUrl("OrganisationCourseId", key, "ViewCourseDates", additionalParams), true);

             


        }

 

 


Mark Breen Ireland 1987 BMW R80 g/s
 
New Post
1/14/2010 3:05 PM
 

To help with security, you can encrypt the parameter value.  There is a DotNetNuke method for that I believe under DotNetNuke.Common.Utilities.UrlUtilities if I remember correctly.  EncryptParameter and DecryptParameter are your values.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
1/16/2010 9:54 AM
 

  Hello Mitch,

Thank you very much, that was exactly what I was looking for.  In case that it is useful to anyone else, here is the line of code that I use to encrypt my Id before I re-direct, and then after that, I have the line of code that I use to -decrypt, thanks again Mitch.

 

// This encrypts the Id before I call re-direct

            String key = Common.Utilities.UrlUtils.EncryptParameter(gridDataItem["Id"].Text);

 

// this decrypts the same Id value and assigns it to the sql data source in this case

String OrgId =  Common.Utilities.UrlUtils.DecryptParameter(Request.QueryString["OrganisationId"]);

 

 

Thanks Again Mitch, 

 

On a general note, is there a better way to pass variables from one page to another?  I am thrilled with the encrypted key, but if I wanted to pass seven or eight values from one screen to the next, the URL is not the best way to do it, do you know how I should be handling that?

 

thanks

Mark

 


Mark Breen Ireland 1987 BMW R80 g/s
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Cross Page Posting - Passing paramsCross Page Posting - Passing params


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out