Saturday, January 2, 2010

How to POST the data from one page to another page without QueryString?

 
Aim :
       
            How to send secure data (like UserID , Password , Encrypt Key, & etc) from one page to another page.

Possible Ways are:
  •    1.  Query String [ security issues - User can read the data].
  •    2.  Cookies
  •    3.  Session [ It's Support only within site]
  •      etc......
Now we can see How to send the data from one Site page to another site page without  QueryString.

Steps

  • First we create two Web application (1. Data sender , 2. Data Receiver ) 
  • Design Two Pages like bellow .

 Data Sender



  • Set the Submit button Property "PostBackURL"


  • There is no need to write any code in sender page

Data Receiver

  • Design the page like this





  • Page load Code Block
   protected void Page_Load(object sender, EventArgs e)
  {
          lblUserName.Text = Request.Params["txtUserName"];
          lblPassword.Text = Request.Params["txtPassword"];
          lblKey.Text = Request.Params["txtKey"];
  }



  • Now run the both applications.




  • Fill the data in Sender page & click the submit button.
  • Once we click the submit button, we can see the second site page, with fist site page data.




Thank You

No comments: