ASP.NET
一、如何:使用 ASP.NET 语法将服务器控件添加到 ASP.NET 网页
可以通过在 .aspx 文件中直接声明 Web 服务器控件将它添加到页中。
以声明方式添加控件
A、如果您位于可视化设计器中,请切换到源编辑视图。
B、将表示该控件的元素键入 .aspx 文件。您使用的具体语法取决于要添加的控件,但通常适用下面的情况:
·控件必须包含 runat="server" 属性。
·设置了控件的 ID 属性,除非该控件是某个复杂控件的一部分且重复出现(如在 GridView、FormView、DetailsView、Repeater 或 DataList 控件中一样)。
·Web 服务器控件是使用引用 asp 命名空间的 XML 标记声明的。
·控件声明必须正确结束。您可以指定显式结束标记,或者如果控件不具有子元素,也可以指定一个自结束标记。唯一的例外是不可以包含子元素的 HTML 输入控件,如输入控件(例如,HtmlInputText 服务器控件声明语法、HtmlImage 服务器控件声明性语法和 HtmlButton 服务器控件声明性语法)。
·控件属性声明为属性。
下面的示例显示 Web 服务器控件的典型声明:
<!-- Textbox Web server control -->
<asp:textbox id="TextBox1" runat="Server" Text=""></asp:textbox>
<!-- Same, but with self-closing element -->
<asp:textbox id="Textbox2" runat="Server" Text="" />
<!-- Web DropDownList control, which contains subelements -->
<asp:DropDownList id="DropDown1" runat="server">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:DropDownList>
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
Company data:
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Font-Names="verda
相关文档:
在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......
ASP.NET 用户配置文件功能设计为提供当前用户的独有信息。配置文件可由通过身份验证的用户使用,也可以由匿名(未经身份验证)用户使用。
1、通过身份验证的用户
默认情况下,用户配置文件与当前 HTTP 上下文(可通过 HttpContext..::.Current 属性访问)的 User 属性中存储的用 ......
对于asp.net,默认只允许上传2M文件,增加如下配置,一般可以自定义最大文件大小.
<httpRuntime executionTimeout="300" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>
我们在上传大文件时都遇到过这样或那样的问题。设置很大的maxRequestLength值并不能完 ......
直接在ASP.net中上传大文件的方法.
方法一:在web.config中添加<httpRuntime maxRequestLength="100000" executionTimeout="45"/>
方法二:修改IIS配置文件windows->system32->inetsrv->metaBase.XML
方法三:
1. httpHandler or HttpModule
a.在ASP.net进程处理request请求之前截获 ......
using System;
using System.Collections.Specialized;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Threading;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebC ......