I want to replace the url which include query string so end user only not able to see the original path of web page. what can I do?
Either:
Use HTML forms with POST instead of regular links or GET forms.
Alter the address bar on client side with javascript, but users can bypass this if they know how to and it's kind of sketchy.
Save the state and redirect from the backend if possible in your environment, though this is an ugly method as well imo unless it's a one-time thing because of people landing on your page from some external link.
Related
Does anyone know if there's a clean way to get the contents of the browser address bar, not the absolute URI?
I know you can use Request.Url.AbsoluteUri to get the full request, and normally that would be fine. However, in this case I need to know if the user has landed on the page via the site's basic DNS.
For example, if my site is called http://www.mysite.com, and the default page is page1.aspx, then Request.Url.AbsoluteUri returns http://www.mysite.com/page1.aspx if a user hits the site from http://www.mysite.com. In this case, all I want to get is: http://www.mysite.com. Is this possible?
The reason behind this is so that I can have the site embed statistical JavaScript code on the root page if the site is hit via the basic URL, and not if the page is included in the address bar. Does this make sense?
The term you are looking is URL ReWriting
Refer this tutorial
Whenever we redirect from one page to another page, Query string can be used. Now when i used the "GET" and "POST" methods in the form tag.
I have got the following findings.
Get - Exposes is the data of password fields in the URL. SO it should not be used. Right?
POST - Some unnecessary data can be accessed from Request .Form of the textbox fields which is not required.
I think, while navigating to another page, I can use Query String on clikcing the button like below.
Response.Redirect("abc.aspx?id=10") //This will be at the code behind level.
and similarly we can use in Java Script like below.
function RedirecToAnotherPage(){
window.open('abc.aspx?id=10');}
Right?
Here, my query is in which case, I can use the "GET" and "Post" method in real life/dynamic website
POST removes constraints that GET has, like maximum query string size. You can control what data is sent by controlling which fields are inside the form tag. You can have multiple form tags and post the relevant one.
If you are creating a secure website you should use POST method
If you are sending a big and bulky datum to a server you have to use post because GET has some limitation.
In case of URL rewriting or you are developing website where you have to use SEO in that case your URL plays an important role; in that situation you should use GET.
GET is faster than POST
You have to choose GET method especially when you want to read and choose POST when you want to write/update (database or file etc). Take a look at article - Methods GET and POST in HTML forms - what's the difference?
To learn more on ASP.NET web-app Forms.
How to: Post ASP.NET Web Pages to a Different Page.
ASP.NET Forms.
In my asp.net 2005 app, I would like conceal the app structure from the user. Currently, the end user can learn intimate details of my web app as they navigate and watch the url change. I don't want the end user to know about my application structure. I would like the browser url to not change if possible. Please advise.
thanks
E.A.
URL rewriting is the only one that can provide any kind of real concealment.
Just moving the requests to AJAX or to frames, means anyone (well, more advanced users) can still see those requests being fired, just not in the address bar.
Simplest solution is to use frames - a single frame that holds your application and is 100% * 100%. The URL will not change though the underlying URL can still be seen via "View Frame info", however only advanced users will even figure that out.
In your pages, make sure that they are contained inside the holding frame.
A couple of possibilities.
1) use AJAX to power everything. This will mean that the user never leaves the home page
2) use postbacks to power everything. In this, you'd have all those pages be user controls which you progrmattically hide or show.
3) URL rewriting (especially if this is asp.net 3.0 or later)
My site uses url parameters to dynamically load ascx files into a single main aspx. So if I get 'page_id=123' on the query string, I load the corresponding ascx. The url changes, but only the query string - the domain part remains the same.
If you want the url to remain precisely the same at all times, then frames (per Oded) or ajax (per Stephen) are probably the only ways to do it.
Short answer: use URL encryption
A simple & straight article: http://devcity.net/PrintArticle.aspx?ArticleID=47
and another article: https://web.archive.org/web/20210610035204/http://aspnet.4guysfromrolla.com/articles/083105-1.aspx
HTH
Which one is better when we want to redirect to a new page in asp.net : using a link button and then Response.Redirect OR using an html link?
Depends on your needs:
Use the <a> tag if there's no need for you to do anything with the form/page you're directing from
use response.redirect if you need information from the form before moving on to the next page, for example to update session states or store intermediate results.
well an anchor tag elimates a round trip to the server.
If you are just linking to another page with a static URL, use an HTML anchor link. It will have better performance and only requires code in one place: the page.
If you need to perform operations on the server before the redirect, including manipulating the URL (e.g. dynamically creating querystring parameters), then use a server control (button, link, linkbutton).
I would use the anchor tag. It seems that with the redirect you are doing extra work with the round trip for not much gain besides using the link button control (at least this is what I am surmising from your question, there are valid reasons to use it). Also (not that this will likely make a difference in your case) it does cause and additional status code to be sent to the browser (302), telling the client application something is potentially amiss). If you are working on a highly secure site and or have non-browser applications accessing the page to pull information, this could be a problem.
Actually you have a third option which might suit your needs. Depending on the way your pages are setup and what you need to do, you can use Server.Transfer also.
If you want to use a button instead of a link just for the way it looks, you can use javascript to change the location of the page in the button's onclick also saving you a trip to the server.
I want to make a site where there user can basically navigate the web from within an iframe. The catch is that I'd like to be able to have more control over what is rendered within the iframe. Specifically,
I'd like to be able to filter out images or text, disable forms etc.
I'd also like to be able to gather feedback such as what links the users clicked on.
Question 1:
Is this even possible using a standard back-end scripting language (like php), with html and javascript on the frontend?
Question 2:
Would I first need to grab the source of the site before it is rendered, then do whatever manipulation is necessary, and finally re-render it somehow?
Question 3:
Could somebody please explain the programming flow that would occur here (assuming its possible)?
I think you would probably want to grab the source of the of site (with server-side code) before rendering it. You might run into cross-site scripting issues if you try to use JavaScript. Your iframe would load a page like render.php and pass the address of the page to render os a querystring parameter. Then use regular expressions to find elements in the HTML that render.php downloads from the address. Rewrite the HTML as necessary and then write it all out to the iframe.
Rewrite links so that that the user is taken to a page you control and redirected onto a target site if you want to track where people are going. Example: a link in the page needs to go to google.com. You would send them to tracker.php?target=http://google.com. You control tracker.php and can log each load of this page and then redirect the user to the target site.
Update:
Another possible solution is to use Apache or other server to proxy the target website. There are modules like mod_proxy for this. There may also be modules that let you parse the HTML or you could roll your own.
I should point out that even the best solutions offered to your question will be somewhat brittle if you do not have full control over the target site. You will want to have lots of error handling or alerting.
You can have a look at this. It uses iFrame really well, and maybe even use the library it has.