
ASP.net
文章平均质量分 72
diandian82
这个作者很懒,什么都没留下…
展开
-
ASP.NET中使用Cache例程
protected void Load_Click(object sender, EventArgs e) { AddFileContentsToCache("TextFile.Txt"); } void AddFileContentsToCache(string fileName) { string file = Server.MapPath(原创 2006-10-30 16:39:00 · 802 阅读 · 0 评论 -
URL重写小结
URL重写有很多中,第三方的url 重写模块也有很多,这里是我对我用过的东西的一些总结。 一,自己手动在asp.net级别的重写, 通过 System.Web.HttpContext 类的 RewritePath() 方法,可以在 ASP.NET 级别实现 URL 重写。HttpContext 类包含有关特定 HTTP 请求的 HTTP 特定信息。对于 ASP.NET 引擎收到的每原创 2009-11-05 21:04:00 · 495 阅读 · 0 评论 -
Preview image when uploading it on client side. Available for IE and FF
1. CSS body{margin:0px;} /*.title { background-image:url(data:image/gif;base64,R0lGODlhAQAcALMAAMXh96HR97XZ98Hf98Xg97DX97nb98Lf97vc98Tg973d96rU97原创 2009-10-31 12:07:00 · 1123 阅读 · 4 评论 -
多语言应用的相关参考
http://www.cnblogs.com/yongheng178/archive/2008/08/14/1267482.html asp.net实现多语言http://www.cnblogs.com/sharemeteor/articles/215069.html windows form + xml实现多语言转载 2009-11-02 10:27:00 · 434 阅读 · 0 评论 -
使用表达式树动态构建Linq查询条件来实现单个实体动态查询
// 得到城市ID,合法的ID>0,其他的小于0 var cid = Convert.ToInt32(ddlCity.SelectedValue); // 创建静态类型为ut_View的参数表达式 ParameterExpression c = Expression.Parameter(typeof(ut_View), "c"原创 2011-06-13 17:12:00 · 2278 阅读 · 0 评论 -
Linq排序并声称新对象列表示例
// 这个表是决定排序顺序的表 List> sortedList = new List>(); // 这个表是将要被排序的表,这张表的关联是: 本表的Key=上表的Value List> desList = new List>(); sortedList.Add(new KeyValuePa原创 2012-02-15 14:38:51 · 1172 阅读 · 0 评论 -
Understanding Request Validation in ASP.NET MVC 3
Introduction:A fact that you must always remember "never ever trust user inputs". An application that trusts user inputs may be easily vulnerable to XSS, XSRF, SQL Injection, etc attacks. XSS and XS转载 2012-02-17 17:10:56 · 806 阅读 · 0 评论 -
ASP.net MVC 属性验证
1. 建立Modelpublic class Order { [ScaffoldColumn(false)] public int OrderID { get; set; } [Required(ErrorMessage = "必须输入名字")] public string FirstName { get; set; }原创 2012-08-06 14:33:12 · 1211 阅读 · 0 评论 -
Ajax.ActionLink使用方法
1. 添加unobtrusive-ajax引用,2. 添加ActionLink@Ajax.ActionLink("Click here to see today's special", "DailyDeal", new AjaxOptions { UpdateTargetId = "testDiv", InsertionMode = InsertionMode.Replace, HttpM原创 2012-08-07 17:50:36 · 7502 阅读 · 0 评论 -
Asp.net MVC 通过Attribute验证datamodel(一)
1. 除了可以使用Required, StringLength等Attribute,asp.net mvc中还可以自定义属于自己的验证Attribute。例如://验证逻辑就是判断专辑的Title是否包含某一个关键字 public class AlbumTitleValidateAttribute : ValidationAttribute { privat原创 2012-08-08 21:23:37 · 2062 阅读 · 0 评论 -
Asp.net MVC 通过Attribute验证datamodel(二) ---使用IClientValidatable
上一篇文章实现的都是服务器端的验证,ASP.net MVC框架给我们提供了非常好的客户端验证机制。下面来修改一下上面的Attribute定义,使其实现IClientValidatable接口//验证逻辑就是判断专辑的Title是否包含某一个关键字 public class AlbumTitleValidateAttribute : ValidationAttribute,IClient原创 2012-08-08 22:17:17 · 2517 阅读 · 1 评论 -
ASP.NET MVC3 学习笔记----HTML.Action()和HTML.RenderAction()
HTML.Action()和HTML.RenderAction()类似于HTML.Partial()和HTML.RenderPartial()辅助方法。Partial辅助方法通常在单独的文件中应用视图标记来帮助视图渲染视图模型的一部分。另一方面,Action是执行单独的控制器操作并显示结果。Action提供了更多的灵活性和重用性,因为控制器操作可以建立不同的模型,可以利用单独的控制器上下文。示原创 2012-07-25 13:44:01 · 14288 阅读 · 1 评论 -
ASP.NET AJAX 添加请求处理事件来防止按钮重复提交
function InitSubmitBtn() { //添加请求处理初始化事件 Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(function(sender, e) { if (Sys.WebForms.PageRequestManager.ge原创 2009-04-21 16:39:00 · 1679 阅读 · 2 评论 -
ASP.NET TreeView 用JS实现节点的单选功能
//用Treeview chekbox节点单选的处理事件 function TreeSingleSelect(treeID, checkNode) { if (!treeID) return; var objs = document.getElementsByTagName("input"); for (va转载 2009-03-20 21:00:00 · 3561 阅读 · 2 评论 -
Build User rights control system in Asp.net.(Windows Form Authentication)
1.You must change your web system to windows form authentication in web.configauthentication mode="Forms"> forms loginUrl="Pub/Login.aspx" name=".ASPXAUTH">forms> authentication>2.原创 2008-12-23 14:04:00 · 644 阅读 · 0 评论 -
关于使用ASP.NET2.0中GridView控件的一些技巧。
// 下面是相关代码:protected void Page_Load(object sender, EventArgs e){ if (!IsPostBack) { // 因为GridView的第一列是Select Command Field,所以我们将其设置为隐藏。 GridView1.HeaderRow.Cells[0].Attributes.Add("style", "display:原创 2006-11-27 12:06:00 · 985 阅读 · 0 评论 -
In order to use Login Control, CreateUser Control and so on in ASP.NET2.0.
The following steps will help you:1. Generally speaking, you can move to this directory "C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727", here you will find a tool called "aspnet_regsql.exe", it is u原创 2006-12-02 13:44:00 · 1013 阅读 · 0 评论 -
The way of using SqlCacheDependency in .net 2.0
aspnet_regsql.exe -? //helpaspnet_regsql.exe -S . -d Northwind -E -ed // Enable the database for sql cache dependency// enable table for sql cache dependencyaspnet_regsql.exe -S . -d Northwind -E原创 2007-01-23 18:53:00 · 1122 阅读 · 0 评论 -
asp.net 路径问题
使用网站中的资源时,通常必须指定资源的路径。例如,您可以使用 URL 路径引用页面中的图像文件或网站中其他位置处的页面的 URL。同样,Web 应用程序中的代码可以使用基于服务器的文件的物理文件路径对文件进行读写操作。ASP.NET 提供用于引用资源并确定应用程序中的页面或其他资源的路径的方法。指定资源的路径许多情况下,页面中的元素或控件必须引用外部资源,如文件。ASP.NET 允许您转载 2007-06-26 10:51:00 · 874 阅读 · 0 评论 -
使用GridView绑定图片的方法,不需要在服务器端生成图片
很多人开始有这个疑问,GridView控件中的ImageField没有DataField属性,那么如何才能绑定到SQL Server中的Image Field?自从DynamicImage控件从beta2中消失后,这就成了个问题。但是,ASP.NET2.0随之也给我们带来了另外一种解决方案,那就是方便地利用HttpHandler(.ashx)动态显示数据库中的图片,这点在VS2005中提供了Per转载 2007-07-12 15:18:00 · 2133 阅读 · 1 评论 -
you have to know about how to create user defined control.
You want to create dynamic user control in you C# code. One thing you must know is, you must register your control in your aspx file. you must add a sentence like this,or else, you cant use the c原创 2007-07-13 14:57:00 · 963 阅读 · 0 评论 -
ASP.net impersonate
默认情况下禁用模拟。为了 ASP 的兼容性,用户必须显式启用模拟。如果为给定的应用程序启用模拟,则 ASP.NET 总是模拟 IIS 提供给 ISAPI 扩展的访问标记。该标记既可以是已验证用户标记,也可以是匿名用户的标记(如 IUSR_MACHINENAME)。不论应用程序中使用哪种身份验证类型,模拟都会发生。只能模拟应用程序代码,编译和配置作为进程标记读取。编译的结果放在“Te原创 2007-06-07 13:33:00 · 1446 阅读 · 0 评论 -
Add module to asp.net
If the user havent logged in, no matter which page he requested, it will be transfer to Login Page.namespace AuthorizationModule...{ public class UserAuthorizationModule : IHttpModule ...{原创 2007-10-03 11:07:00 · 823 阅读 · 0 评论 -
定时刷新客户端的两种方法
1. Use meta tag /* 5: interval time*/ 2. use javascript. (Generate javascript from the server side) string script = "/n" +" window.setInterval(postme(),5000);/n" + " functio原创 2008-12-08 14:17:00 · 1365 阅读 · 0 评论 -
异步刷新Browser的两种方法
1. 使用asp.net ajaxhtml xmlns="http://www.w3.org/1999/xhtml" >head runat="server"> title>title> script type="text/javascript"> setInterval("test()", 5); function te原创 2008-12-08 15:23:00 · 1766 阅读 · 0 评论 -
Customize web.config sections and register your own configuration then get values in asp.net
1. Please firstly add reference System.Configuration2.In web.config file you must register your own section under the path /configuration/configSectionsHere I will show the example:configura原创 2008-12-23 10:32:00 · 700 阅读 · 0 评论 -
Asp.net MVC Form authentication 示例代码
[HttpPost] public ActionResult LogOn(User model, string returnUrl) { if (ModelState.IsValid) { if (model.Logon()) {原创 2011-11-02 15:15:32 · 2902 阅读 · 0 评论