Rahul
Rahul

Reputation: 2307

Hiding Querystring into URL

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?

Upvotes: 3

Views: 2345

Answers (3)

CodeHacker
CodeHacker

Reputation: 2137

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.

Upvotes: 0

TGH
TGH

Reputation: 39248

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

Upvotes: 1

Nilesh Gajare
Nilesh Gajare

Reputation: 6398

  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.

Upvotes: 0

Related Questions