PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5. The application runs on Microsoft IIS 6.0. You create a page named
oldPage.aspx.You need to ensure that the following requirements are met when a user
attempts to access the page:
The browser displays the URL of the oldPage.aspx page.

The browser displays the page named newPage.aspx.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Server.Transfer(“newPage.aspx”);

B.
Response.Redirect(“newPage.aspx”);

C.
if (Request.Url.UserEscaped) { Server.TransferRequest(“newPage.aspx”);
}
else {
Response.Redirect(“newPage.aspx”, true);
}

D.
if (Request.Url.UserEscaped) { Response.RedirectLocation = “oldPage.aspx”;
Response.Redirect(“newPage.aspx”, true);
}
else { Response.Redirect(“newPage.aspx”);
}

Explanation:
Response.Redirect will cause the new Url to appear in the Address Bar of the browser. Therefore, one must use Server.Transfer instead.


Leave a Reply