What is the difference between Server.Transfer and
Response.Redirect? Why would you choose one over the other?
Answers were Sorted based on User's Feedback
Server.transfer redirects the output to another page
whereas response.redirect Redirects/moves the user to
another page .
If u want to submit output of one page to another page use
sever.transfer. if u want to navigate to another page use
Response.Redirect.
Is This Answer Correct ? | 17 Yes | 4 No |
Answer / santosh
In response.redirect the page's state is not maintained.
while in server.transfer it is maintained.
In response.redirect the user makes request to browser to
transfer to another page and then the browser serves the
request.
While in server.transfer this roundtrip is not there the
user is directly transfered to another page.
Is This Answer Correct ? | 11 Yes | 5 No |
Answer / sharifuddin
OK Swapna, I accept your answer?
But i want to know how the server.transfer page handles the
output of the source page? Can u explain?
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / belmonte
session statte is maintained when you use Response.Redirect
Is This Answer Correct ? | 5 Yes | 4 No |
Answer / ramesh
Server.Redirect:
response the page or return output without any request from
the client(Browser)
ex
Server.Redirect("Demo.aspx")
Disadvantage
it does not allow query String
Request.Redirect:
send the request(page) to server and processed it, finaly
redirect to corressponding page
Response.Redirect("Demo.aspx")
Is This Answer Correct ? | 5 Yes | 4 No |
Answer / for ref
Please ignore.
Put this in aspx:
<div style="<%= displayProp %>">
<table cellpadding="0" cellspacing="0" border="1">
<tr>
<td>Name:</td>
<td>Thiyagu</td>
</tr>
<tr>
<td>Age:</td>
<td>25</td>
</tr>
</table>
</div>
Put this in .cs
int val = 0;
if (val == 0)
{
displayProp = "display:none;";
}
else
{
displayProp = string.Empty;
}
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / x
Please Ignore:
function Submit(){
if(window.confirm("Do you want to close?")){
return true;
}else{
return false;
}
}
<asp:Button ID="btnSubmit" runat="server"
OnClientClick="return Submit()" Text="Submit" />
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / s
Please Ignore:
if(false == my_window.closed)
{
my_window.close ();
}
else
{
alert('Window already closed!');
}
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / x
Please Ignore:
function opennewsletter(){
emailwindow=dhtmlmodal.open
('EmailBox', 'iframe', 'newsletter.aspx?
name=bala', 'Newsletter Signup
page', 'width=350px,height=200px,center=1,resize=0,scrolling
=1')
}
Put this in the modal page:
if (Request.QueryString["name"] != null &&
Request.QueryString["name"].ToString() != string.Empty)
{
name = Request.QueryString["name"].ToString
();
}
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / x
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="ModalSave.aspx.cs" Inherits="ModalSave" %>
<!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 id="Head1" runat="server">
<title>Save Version</title>
<Link href="StyleSheet.css" type="text/css"
rel="stylesheet"/>
<script language="javascript" type="text/javascript">
// <!CDATA[
function Submit(){
var rb = document.forms[0].RadioButtonList1;
var myOption = -1;
for (var i=0; i< rb.length; i++)
{
if (rb[i].checked)
{
myOption = i;
//alert ("Please select Major/Minor choice");
}
}
if (myOption == -1)
{
alert ("Please select Major/Minor choice");
return false;
}
if(window.confirm("Please Confirm that you want to create
a new version"))
{
parent.emailwindow.hide();
//parent.location.replace("Entry.aspx?Save=Y");
return true;
}
else
{
return false;
}
}
function Submitnew(){
if(window.confirm("Please Confirm that you want to create
a new version"))
{
parent.emailwindow.hide();
//parent.location.replace("Entry.aspx?Save=Y");
return true;
}
else
{
return false;
}
}
function Cancel(){
parent.emailwindow.hide();
//parent.emailwindow.close();
alert("He");
//parent.location.replace("Default.aspx?Save=Y");
//parent.emailwindow.close();
//window.close();
return true;
}
// ]]>
</script>
</head>
<body class="background" bottommargin="0" leftmargin="0"
rightmargin="0" topmargin="0">
<form id="form1" runat="server" method="post"
action="modalSave.aspx">
<div class="SaveAlign" style="<%= Title %>" >
<asp:Label ID="lblSave" runat="server" Text="Save
Release" BackColor="#66B6AF" BorderColor="Teal"
BorderStyle="Solid" BorderWidth="1px"
Width="306px"></asp:Label>
<div style="<%= displayProp %>">
<table border="0" cellpadding="0" cellspacing="0"
style="margin-left:5px">
<tr>
<td align="left" class="fontclass" style="height: 30px"
><asp:Label ID="lblProject" runat="server"
Text="Projcode"></asp:Label></td>
<td align="left" class="fontclass" style="height: 30px"
><asp:Label ID="txtProject" runat="server"
></asp:Label></td>
</tr>
<tr style="margin-top:10px">
<td align="left" class="fontclass" style="height:
24px;margin-top:10px" ><asp:Label ID="lblVersion"
runat="server" Text=" Release No." Width="96px"
></asp:Label></td>
<td align="left" class="fontclass" style="height:
24px;margin-top:10px" > <asp:Label ID="Label5"
runat="server" Text="1.00" Width="96px" ></asp:Label>
</td>
</tr>
<tr>
<td align="left" class="fontclass" style="height:
40px"><asp:Label ID="lblDesc" runat="server" Text="Label">
Description</asp:Label></td>
<td align="left" style="height: 40px"><textarea
id="txtADesc" runat="server" cols="20" style="height: 27px"
></textarea></td>
</tr>
<tr>
<td align="left" class="fontclass" style="height: 20px">
<asp:Button ID="Button2" class="DSSbuttonStyle"
runat="server" OnClientClick="return Submitnew()"
Text="Confirm" OnClick="Button2_Click" />
</td>
<td align="left" class="fontclass" style="height: 20px">
<%-- <asp:Button ID="Button3" class="DSSbuttonStyle"
runat="server" OnClientClick="return Cancel()"
Text="Cancel"/> --%>
<input id="Button3" type="button" class="DSSbuttonStyle"
value="Cancel" onclick="Cancel()"/>
</td>
</tr>
</table>
</div>
<div style="<%= displayProp1 %>">
<table id="table2" border="0" cellpadding="0"
cellspacing="0" style="margin-left:5px;" visible="false">
<tr>
<td align="left" class="fontclass" style="height: 30px"
><asp:Label ID="Label1" runat="server"
Text="Projcode"></asp:Label></td>
<td align="left" class="fontclass" style="height: 30px"
><asp:Label ID="txtProject1" runat="server"
></asp:Label></td>
</tr>
<tr style="margin-top:10px">
<td align="left" class="fontclass" style="height:
24px;margin-top:10px" ><asp:Label ID="Label6"
runat="server" Text="Latest Release" Width="96px"
></asp:Label></td>
<td align="left" class="fontclass" style="height:
24px;margin-top:10px" > <asp:Label ID="Label7"
runat="server" Width="96px" ></asp:Label>
</td>
</tr>
<tr>
<td align="left" class="fontclass"><asp:Label
ID="Label3" runat="server" Text=" Release No." Width="96px"
></asp:Label></td>
<td align="left" class="fontclass"><asp:RadioButtonList
ID="RadioButtonList1" runat="server" CellPadding="0"
CellSpacing="0" Height="20px" RepeatDirection="Horizontal"
Width="119px" style="left: -5px; clip: rect(20px auto auto
auto); position: relative; top: 7px">
<asp:listitem Value="Minor">Minor</asp:listitem>
<asp:listitem Value="Major">Major</asp:listitem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td align="left" class="fontclass" style="height:
50px"><asp:Label ID="Label4" runat="server" Text="Label" >
Description</asp:Label></td>
<td align="left" style="height: 50px"><textarea
id="Textarea1" runat="server" cols="20" style="height:
28px" ></textarea></td>
</tr>
<tr>
<td align="left" class="fontclass" style="height:
20px"><asp:Button ID="Button1" class="DSSbuttonStyle"
runat="server" OnClientClick="return Submit()"
Text="Confirm" OnClick="Button1_Click" /></td>
<td align="left" class="fontclass" style="height: 20px">
<%-- <asp:Button ID="Button4" class="DSSbuttonStyle"
runat="server" OnClientClick="return Cancel()"
Text="Cancel" /> --%>
<input id="Button4" class="DSSbuttonStyle"
value="Cancel" type="button" onclick="Cancel()"/>
</td>
</tr>
</table>
</div>
<div style="width:30px"> </div>
</div>
</form>
</body>
</html>
Is This Answer Correct ? | 1 Yes | 1 No |
1.can we add connection string in global.asax?????????? 2.what are the default files included when we create new web application????
what is mean by framework?
What are the different methods that are used during the page load?
Which is the parent class of the ASP.NET server control?
0 Answers Sans Pareil IT Services,
How can we register exception filter globally?
List the events in page life cycle.
with which controls you worked in Asp.net 2.0?
2 Answers HP, nTech Solutions,
can we edit records from repeater control
Describe the difference between inline and code behind - which is best in a loosely coupled solution Tightly coupled - INLINE
Master Page
What is the current version of asp.net?
can any one explain about 3-tier architecture and how to deploy 3 layers of 3-tier architecture in 3 different servers.plz send me .net code