Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using this:

document.location ='my different asp.net page?=myparams'

Is there a way to hide the values of the params in the URL displayed on the browser?

I know I could use hidden Form values and I know I can encrypt the values (which is what I will do if no joy here).

Is there a simpler tidier way of doing this? Perhaps via JQuery.

share|improve this question
1  
To what end? You're telling the user to request something, why does it matter that they can see what is being requested? –  Quentin Feb 5 '14 at 15:00
    
You can set the parameters from JS (location.search = params), but that'll show the parameter in the url bar. As far as I know, there's not really a way to "post" parameters. –  Cerbrus Feb 5 '14 at 15:01
1  
If you do not want to pass the values in the querystring, than you can not use a GET request. –  epascarello Feb 5 '14 at 15:02
    
Doing this with JS sounds messy. Please look at method 1 here: weblogs.asp.net/scottgu/archive/2007/02/26/… –  degenerate Feb 5 '14 at 15:02
    
@Quentin Hi, thanks for your comment. I actually agree with you. It should not be an issue. I normally use session objects but the very fact the session_end is not guarantee to trigger I need to find another mechanism to use. By passing the values via query string I can afford using the session object. My quest to hide a querystring is just habit an interest to know if this is possible –  Andrew Simpson Feb 5 '14 at 15:05

2 Answers 2

up vote 2 down vote accepted

If you are just trying to hide the url parameters from the address bar in the browser then you could use an iframe.

share|improve this answer
    
Here's a sample of a full page iFrame. –  iii Feb 5 '14 at 15:31
    
Thank you for trying to help me. :) –  Andrew Simpson Feb 5 '14 at 16:01

One solution is to set document.location to a second page, that page keep param values in a session variable and redirect to your desired one.

document.location = "redirectpage.php?param=value"

In redirectpage.php

$_SESSION['param']=$_GET['param]; header('Location: ' . desired_page?param=value);

By this way, value of param will be only displayed in a very short time when redirectpage.php redirecting to desired page.

Hope it helps

Btw, can you explain how hidden Form works in this case?

share|improve this answer
    
Hi, thanks for the info. I have never implemented hidden forms. I have heard that is a possible solution. thanks so much for your time :) –  Andrew Simpson Feb 5 '14 at 16:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.