Difference between server.Execute and response.redirect ?
Answers were Sorted based on User's Feedback
Answer / ram
Response.Redirect redirects from one page to other page with
roundtrip
Server.Execute method can be used after the page processing
is started, allowing the programmer to choose which page to
execute depending on user input.
http://www.interview-questions.maxmice.com
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / jalaja
Server.execute combines the results of 2 pages into 1 page.
It is normally used when the second page does not have
controls which trigger postback events.
Response.redirect is used to redirect to another page from
the first page
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / zohaib shahid
u can also use the Server.Execute method to post ur form
data to the next page on which u are going, or on which u
have mentioned the action
| Is This Answer Correct ? | 8 Yes | 3 No |
Response.Redirect method :--------
it helps in navigating to another page from code. This is like clicking a hyperlink.To navigate from one page to another using button click or linkbutton control or from server side code use Response Object's Redirect method.
using Response.rediect() method u can not get information from source page on target page.
its source code is like
VB.Net Code
Private Sub Button1_Click(ByVal Sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
'Display target page.
Response.Redirect("Target.aspx")
End Sub
C# Code
private void Button1_Click(Object sender, System.EventArgs e)
{
//Display Target Page.
Response.Redirect("Target.aspx");
}
Using Server.Execute Method
use Server.Execute Method to process a Target web form without leaving the Source page. This technique let you embed the result from a target page to a region on Source page. Like Server.Transfer, It also required EnableViewStateMac attribute to page directive set to false.
Suppose I have to pages one is Calculate.aspx havinf two textboxes and a button control. On button Click event. I performed Server.Execute to Result.aspx another aspx page.
Source Code
protected void btn_Click(object sender, EventArgs e)
{
Server.Execute("Result.aspx");
}
Result.aspx page pageload event.
protected void Page_Load(object sender, EventArgs e)
{
NameValueCollection colform = new NameValueCollection();
colform = Request.Form;
Response.Write("<h2>Additon Result:</h2>" + (Convert.ToInt32(colform["TextBox1"]) + Convert.ToInt32(colform["TextBox2"])));
}
If any Mistake then suggest me...plz
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / shashi singh
server.execute method can be used go from one page to
another page while response.redirect redirects from one
site to another site.
| Is This Answer Correct ? | 3 Yes | 6 No |
Why is it preferred to not use finalize for clean up?
What is viewstate? In which event of the page life cycle, is the viewstate available?
Is it possible to use two versions of assembly at the same time?If possible explain with code?
what is Disco?what it will do?
which scripting is used browser by server when we use validation controls. 1.javascript 2.vbscript 3.jscript 4.perl
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
What are the different types of validation controls in asp.net?
How do I use response redirect?
Explain swagger components.
What are the advantages and disadvantages of viewstate ?
Are cookies stored on server or client?
How does SQL Server session state works
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)