3

I want to hide the Querystring which is displayed into my URL as shown below in Image::

enter image description here

I am opening it into New Window as::

1) Jquery Code to Oepn New Window:

 var url = rootUrl("Home/Test?Docs=" + check);
 var w = window.open(url, '_blank');

And 2) Controller(Server side) code :

    public class TestViewModel
    {
        public string Docs { get; set; }
        public long DocIDs { get; set; }
        public long TestIDs { get; set; }
    }
    public ActionResult Test(TestViewModel Test)
    {
        return View();
    }

But in this case the Document IDs displayed into the Querystring. I just want to hide the Querystring for more security. How can I do this?

Rahul
  • 2,309
  • 6
  • 33
  • 60
  • Follow this link : http://stackoverflow.com/questions/3951768/window-open-and-pass-parameters-by-post-method – Bappi Datta Jan 29 '14 at 05:04
  • You are asking the wrong question. Whether or not someone can see the document id should not matter to the security of your web app. If you are relying on hiding a variable to secure your application, you are doing it wrong. See http://stackoverflow.com/a/245586/130387 for more information – Tommy Jan 29 '14 at 05:08
  • @BappiDatta But as shown above in the URL I am posting List of Documents maybe more. then in that case I need to hide those IDs. – Rahul Jan 29 '14 at 05:55

3 Answers3

1

You can do a post request instead. If you want it to be encrypted you should send it over https

TGH
  • 38,769
  • 12
  • 102
  • 135
0
  1. You can store data in session variables or try storing values in cookies.

  2. It would be better to use TempData, which only allows the value to be used once (removed on first access). However, this implies the value will be used almost immediately.

  3. encrypt the querystring.

Nilesh Gajare
  • 6,302
  • 3
  • 42
  • 73
0

If you don't want to show the parameters, then don't send them store them in hidden fields in your main page, then on the opened window (TEST) get the values with JavaScript with window.opener.document.getElementById('ID_OF_THE_HIDDEN_ELEMENT_IN_THE_PARENT_PAGE').

Look at this example I wrote for another answer.

Community
  • 1
  • 1
CodeHacker
  • 2,127
  • 1
  • 22
  • 35