C# .NET - url - Asked By Indu P on 01-Feb-10 04:41 AM

How to redirect html pages without url change
Sakshi a replied to Indu P on 01-Feb-10 04:52 AM

1. Show/Hide content using div tags.

2. Frames

3. Produce dynamic content on click of some buttons.


Thanks and Regards,
http://www.CodeCollege.NET
http://www.InterviewsGuru.info



Web Star replied to Indu P on 01-Feb-10 04:58 AM

use Server.Transfer(url);

this doesn't update browser's history so url doesn't change in address bar just page load

mv ark replied to Indu P on 01-Feb-10 05:03 AM
Use Frames or IFrame. Check example here - http://roshanbh.com.np/2008/04/hide-url-display-same-url-website.html

Alternatively, have a common template page & fetch content of non-standard parts of the page using AJAX
Santhosh N replied to Indu P on 01-Feb-10 05:04 AM

You could  actually configure in IIS for handling certain urls to mask the actual url and the same thing can be done on server side and client side code by reading server response..

check http://blogs.msdn.com/david.wang/archive/2005/08/01/HOWTO_Common_URL_Redirection_Techniques_for_IIS_Summary.aspxexplaining how to accomplish this at various levels..


Indu P replied to Web Star on 01-Feb-10 05:25 AM
We cannot use server.transfer.. coz these r pure html pages
DL M replied to Indu P on 01-Feb-10 05:31 AM
You can do using iframe but you cannot have any controls inside an iFrame.show below code sample

IFrameRedirect.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="IFrameRedirect.aspx.cs" Inherits="General_IFrameRedirect" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Sample Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <iframe id="ifNew" title="Sample" src="One.aspx">
            </iframe>
        </div>
    </form>
</body>
</html>

One.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="One.aspx.cs" Inherits="General_One" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>One Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:HyperLink ID="h1" runat="server" NavigateUrl="~/YourPage.aspx" Text="Hello" />
        </div>
    </form>
</body>
</html>

Here used HyperLink to redirect the same page. You use button and use Response.Redirect to redirect the page.
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Kirtan Patel replied to Indu P on 02-Feb-10 07:50 AM
You cannot do this by simply HTML you need to use server side coding like PHP or Asp.net