Click here to Skip to main content
15,888,286 members
Articles / Programming Languages / C#

ISD Code Customization Tips, Part III: Avoid Reading QueryString Directly

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
28 Jan 2014CPOL 4.1K   1  
ISD Code Customization Tips, Part III: Avoid Reading QueryString Directly

Introduction

ISD makes it trivial to implement URL parameter encryption. All you need to do is to tick a checkbox in application generation options. This is extremely helpful in scenarios when you need to turn on/off the functionality in the middle of your development. For example, your client requests to add URL encryption at the last minute before you are ready to release the application. Another scenario is that you had encryption turned on from the beginning of your project. In order to track a tricky bug, you turned encryption off temporarily. After the bug was fixed, you turned encryption back on.

However, if you read URL parameters directly in your customization code, like this:

C#
string companyId = Page.Request.QueryString["CompanyId"];

you lose all the flexibility and convenience ISD provides. That's because ISD adds/removes encryption-related code only in auto generated section II. It does not touch custom code in section I. Therefore, it is your responsibility to switch on/off encryption in section I.

Tip

In order to read URL parameters in section I custom code without losing the encryption on/off flexibility, you can use URL( ) formula function, like this:

C#
string companyId = EvaluateFormula("URL(\"CompanyId\")");

Formula function URL( ) automatically decrypts parameters if URL encryption is turned on. 

This article was originally posted at http://jingding.blogspot.com/feeds/posts/default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --