2022微软认证考试练习题及答案(24)
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a page that contains the following code fragment.
You write the following code segment in the code-behind file for the page.
void BindData(object sender, EventArgs e) {
lstLanguages.DataSource = CultureInfo.GetCultures(CultureTypes.AllCultures);
lstLanguages.DataTextField = “EnglishName“; lstLanguages.DataBind();
}
You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback.
Which line of code should you insert in the constructor of the page?
You create a page that contains the following code fragment.
You write the following code segment in the code-behind file for the page.
void BindData(object sender, EventArgs e) {
lstLanguages.DataSource = CultureInfo.GetCultures(CultureTypes.AllCultures);
lstLanguages.DataTextField = “EnglishName“; lstLanguages.DataBind();
}
You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback.
Which line of code should you insert in the constructor of the page?
A.this.Init += new EventHandler(BindData);
B.this.PreRender += new EventHandler(BindData);
C.lstLanguages.PreRender += new EventHandler(BindData);
D.lstLanguages.SelectedIndexChanged += new EventHandler(BindData);
Answer: A
QUESTION 37
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 diplays the URL of the oldPage.aspx page.
The browser displays the page named newPage.aspx Which code segment should you use?
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“); }
Answer: A
QUESTION 38
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web page named enterName.aspx. The Web page contains a TextBox control named txtName. The Web page cross posts to a page named displayName.aspx that contains a Label control named lblName.
You need to ensure that the lblName Label control displays the text that was entered in the txtName TextBox control.
Which code segment should you use?
A.lblName.Text = Request.QueryString[“txtName“];
B.TextBox txtName = FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
C.TextBox txtName = Parent.FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
D.TextBox txtName = PreviousPage.FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
Answer: D
QUESTION 39
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
Which code segment should you use?
A.lblName.Text = Request.QueryString[“txtName“];
B.TextBox txtName = FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
C.TextBox txtName = Parent.FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
D.TextBox txtName = PreviousPage.FindControl(“txtName“) as TextBox; lblName.Text = txtName.Text;
Answer: D
QUESTION 39
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code segment to create a class named MultimediaDownloader that implements the IHttpHandler interface.
namespace Contoso.Web.UI {
public class MultimediaDownloader : IHttpHandler {
...
} }
The MultimediaDownloader class performs the following tasks:
It returns the content of the multimedia files from the Web server It processes requests for the files that have the .media file extension The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0.
You need to configure the MultimediaDownloader class in fig file of the application.
Which code fragment should you use?
A.
spring framework面试题namespace Contoso.Web.UI {
public class MultimediaDownloader : IHttpHandler {
...
} }
The MultimediaDownloader class performs the following tasks:
It returns the content of the multimedia files from the Web server It processes requests for the files that have the .media file extension The .media file extension is mapped to the aspnet_isapi.dll file in Microsoft IIS 6.0.
You need to configure the MultimediaDownloader class in fig file of the application.
Which code fragment should you use?
A.
B.
C.
D.
Answer: C
QUESTION 40
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a class that implements the IHttpHandler interface. You implement the ProcessRequest method by using the following code segment. (Line numbers are included for reference only.)
01 public void ProcessRequest(HttpContext ctx) {
02
03 }
You need to ensure that the image named Alert.jpg is displayed in the browser when the ha
C.
D.
Answer: C
QUESTION 40
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a class that implements the IHttpHandler interface. You implement the ProcessRequest method by using the following code segment. (Line numbers are included for reference only.)
01 public void ProcessRequest(HttpContext ctx) {
02
03 }
You need to ensure that the image named Alert.jpg is displayed in the browser when the ha
ndler is requested.
Which code segment should you insert at line 02?
A.StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath(“Alert.jpg“)));
ctx.Response.Pics(sr.ReadToEnd());
sr.Close();
B.StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath(“Alert.jpg“)));
ctx.Response.Pics(“image/jpg“);
ctx.Response.TransmitFile(sr.ReadToEnd());
sr.Close();
C.ctx.Response.ContentType = “image/jpg“;
FileStream fs = File.OpenRead(ctx.Server.MapPath(“Alert.jpg“));
int b;
while ((b = fs.ReadByte()) != -1) {
ctx.Response.OutputStream.WriteByte((byte)b);
Which code segment should you insert at line 02?
A.StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath(“Alert.jpg“)));
ctx.Response.Pics(sr.ReadToEnd());
sr.Close();
B.StreamReader sr = new StreamReader(File.OpenRead(ctx.Server.MapPath(“Alert.jpg“)));
ctx.Response.Pics(“image/jpg“);
ctx.Response.TransmitFile(sr.ReadToEnd());
sr.Close();
C.ctx.Response.ContentType = “image/jpg“;
FileStream fs = File.OpenRead(ctx.Server.MapPath(“Alert.jpg“));
int b;
while ((b = fs.ReadByte()) != -1) {
ctx.Response.OutputStream.WriteByte((byte)b);
}
fs.Close();
D.ctx.Response.TransmitFile(“image/jpg“);
FileStream fs = File.OpenRead(ctx.Server.MapPath(“Alert.jpg“));
int b;
while ((b = fs.ReadByte()) != -1) {
ctx.Response.OutputStream.WriteByte((byte)b);
}
fs.Close();
Answer: C
fs.Close();
D.ctx.Response.TransmitFile(“image/jpg“);
FileStream fs = File.OpenRead(ctx.Server.MapPath(“Alert.jpg“));
int b;
while ((b = fs.ReadByte()) != -1) {
ctx.Response.OutputStream.WriteByte((byte)b);
}
fs.Close();
Answer: C
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论