ASP.NET面试题【汇总贴】
1、Session有什么重大BUG,微软提出了什么方法加以解决?
答:是iis中由于有进程回收机制,系统繁忙的话Session会丢失,可以用Sate server或SQL Server数据
库的方式存储Session不过这种方式比较慢,而且无法捕获Session的END事件。
2.产生一个int数组,长度为100,并向其中随机插入1-100,并且不能重复。
C# code
int[] intArr=new int[100];
ArrayList myList=new ArrayList();
Random rnd=new Random();
while(myList.Count<100)
{
int num=rnd.Next(1,101);
if(!myList.Contains(num))
myList.Add(num);
}
for(int i=0;i<100;i++)
intArr[i]=(int)myList[i];
3.ADO.net中常用的对象有哪些?分别描述一下。
答:Connection 数据库连接对像
Command 数据库命令
DataReader 数据读取器
DataSet 数据集
4.<%# %> 和 <% %> 有什么区别?
答:<%# %>表示绑定的数据源
<% %>是服务器端代码块
Asp.net清空页面上的所有TextBox
C# code
foreach (Control c in this.FindControl("form1").Controls)
{
if (c is TextBox)
{
((TextBox)c).Text = "";
}
}
客户端事件
JScript code
<script language="javascript" type="text/javascript">
function ClearAllTextBox() {
var obj = window.document.forms[0];
for (i = 0; i < obj.elements.length; i++) {
var elem = obj.elements[i];
if (elem) {
if (elem.type == "text") {
elem.value = "";
}
}
}
}
</script>
C# code
Random r = new Random();
List<int> iNumberList = new List<int>();
int i = r.Next(1, 100);//第一个数不可能重复 所以先把它添加进去
iNumberList.Add(i);
while (iNumberList.Count < 100)
{
while (iNumberList.Contains(i))
{
i = r.Next(1, 101);
}
iNumberList.Add(i);
}
2.什么是ASP.net中的用户控件
答:用户控件就是.ascx扩展名的东西喽,
相关文档:
作者: 王景 来源: 博客园 发布时间: 2010-03-08 14:18 阅读: 239 次 原文链接 [收藏]
最近在招聘新的团队成员中,自己想出了一些问题。先列出来,有机会不断更新吧。
第一部分:
互相介绍及了解
1.请介绍一下你 ......
本文示例源代码或素材下载
一.摘要
一个Url请求经过了Routing处理后会调用Controller的Action方法. 中间的过程是怎样的? Action方法中返回ActionResult对象后,如何到达View的? 本文将讲解Controller的基本用法, 深入分析Controller的运行机制, 并且提供了创建所有类型Action的代码. 值得学习ASP.NET MVC时参考.
......
本主题介绍在 IIS 7.0 集成模式下运行以及与 IIS 7.0 或更高版本一起运行的 ASP.NET 应用程序的应用程序生命周期。IIS 7.0 还支持经典模式,其行为类似于在 IIS 6.0 中运行的 ASP.NET。有关更多信息,请参见 IIS 5.0 和 6.0 的 ASP.NET 应用程序生命周期概述。
IIS 7.0 集成管道是一种统一的请求处理管道,它同时支 ......
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web ......
UpdatePanel控制页面的局部更新,这个更新功能依赖于scriptManger控件的EnablePartialRendering属性,如果这个属性设置为false局部更新会失去作用(scriptManger控件的EnablePartialRendering属性的默认值为true不必刻意去设置)
下面是一个完整的UpdatePanel的结构:
复制代码 代码如下:
<asp:ScriptManager  ......