
ASP.NET
lglgsy456
这个作者很懒,什么都没留下…
展开
-
字符串相似算法 Jaro-Winkler Distance (string distance)
aro-Winkler Distance 算法这是一种计算两个字符串之间相似度的方法,想必都听过Edit Distance,Jaro-inkler Distance 是Jaro Distance的一个扩展,而Jaro Distance(Jaro 1989;1995)据说是用来判定健康记录上两个名字是否相同,也有说是是用于人口普查,具体干什么就不管了,让我们先来看一下Jaro Distanc转载 2016-03-30 16:35:57 · 3259 阅读 · 0 评论 -
OWIN
http://msdn.microsoft.com/en-us/magazine/dn451439.aspxASP.NETGetting Started with the Katana ProjectHoward DierkingWhen ASP.NET was first released back in 2002, times转载 2014-04-07 15:23:18 · 5734 阅读 · 0 评论 -
WCF快速入门教程
http://blog.51cto.com/zt/129转载 2014-05-07 11:54:31 · 571 阅读 · 0 评论 -
ASP.NET Identity with the Entity Framework
http://odetocode.com/blogs/scott/archive/2014/01/03/asp-net-identity-with-the-entity-framework.aspx转载 2014-04-17 16:17:38 · 658 阅读 · 0 评论 -
ASP.NET Web API 配置返回的json字段的格式以及Action返回HttpResponseMessage类型
1. 对于返回的Json对象格式是以“帕斯卡”风格的(例如“FirstName”),然而我们的Api有很大的可能被带有Javascript的客户端消费,对于JS开发者来说可能更适合“驼峰”风格(例如”firstName”)的数据。解决方案:配置Json格式。Web Api提供Xml和JSON作为返回数据的格式,框架会自动把这些格式注入管线。客户端可以通过Http请求头部来声明需要的数据格式转载 2014-04-15 15:34:20 · 14738 阅读 · 0 评论 -
FormAuthentication Stuff
public void SetAuthCookie(int memberId, stringaccountType) { var newTicket = new FormsAuthenticationTicket(1, memberId.ToString(), DateTime.No原创 2014-03-28 09:54:23 · 1306 阅读 · 0 评论 -
具有 Windows Azure AD 和 Microsoft OWIN 组件的安全 ASP.NET Web API
http://msdn.microsoft.com/zh-cn/magazine/dn463788.aspx转载 2014-03-10 17:53:55 · 966 阅读 · 0 评论 -
Versioning RESTful Services
Versioning RESTful ServicesPosted by Howard Dierking on November 9, 2012I’ve talked about this in various venues and also cover it in my Pluralsight REST Fundamentals course, but the t转载 2014-03-07 15:07:30 · 818 阅读 · 0 评论 -
在ASP.NET MVC2中使用自定义的AuthorizeAttribute绕过内置的Membership/Role机制
感谢 DSO at http://stackoverflow.com/users/38087/DSO 在ASP.NET MVC2中,我们可以使用Authorize Filter限制用户对内容的访问,如[c-sharp] view plaincopyprint?[Authorize] public class MyControll转载 2014-03-06 15:18:00 · 1280 阅读 · 0 评论 -
JSON和JSONP 详细介绍,很COOL
尊重原创:http://www.cnblogs.com/dowinning/archive/2012/04/19/json-jsonp-jquery.html前言: 由于Sencha Touch 2这种开发模式的特性,基本决定了它原生的数据交互行为几乎只能通过AJAX来实现。当然了,通过调用强大的PhoneGap插件然后打包,你可以实转载 2014-03-04 17:41:07 · 705 阅读 · 0 评论 -
unit Test HttpContext.单元测试,模拟HttpContext
HttpContextBase 类为抽象类,该类包含的成员与 HttpContext 类相同。 使用 HttpContextBase 类可以创建一些派生类,这些派生类与HttpContext 类相似,但是可以进行自定义并在 ASP.NET 管道外部使用。 在执行单元测试时,通常使用派生类实现具有自定义行为的成员以实现正在测试的方案,这更容易进行单元测试。HttpContextWrapper类是原创 2014-05-09 14:20:57 · 1540 阅读 · 0 评论 -
Nop Commerce 源代码
http://www.51aspx.com/CodeFile/NopCommerce23/Libraries/Nop.Core/Caching/PerRequestCacheManager.cs.html转载 2014-05-09 11:20:12 · 790 阅读 · 0 评论 -
.net Async await Task<T>
http://www.cr173.com/html/17820_1.html原创 2014-05-07 10:23:54 · 1032 阅读 · 0 评论 -
Download page Over SSL
//Download Directly //var page = client.DownloadString(url); //using (StreamWriter sw = File.CreateText(filePath)) //{ // sw.Writ原创 2015-11-30 18:14:18 · 359 阅读 · 0 评论 -
HMAC authentication in ASP.NET Web API
HMAC authentication in ASP.NET Web API28 FEBRUARY 2013 on delegating handlers, ASP.NET Web API, HTTP, HMAC authentication, http authentication, md5, Security, HMACIn this article I will explain转载 2015-02-26 14:46:25 · 1582 阅读 · 0 评论 -
ASP.NET MVC 5 Authentication Breakdown : Part Deux
In my previous post, "ASP.NET MVC 5 Authentication Breakdown", I broke down all the parts of the new ASP.NET MVC authentication scheme. That's great, but I didn't have a working example that you, a转载 2015-02-26 17:17:23 · 1255 阅读 · 0 评论 -
https://github.com/aspnet/开源
https://github.com/aspnet/Identity转载 2014-05-15 10:13:19 · 2546 阅读 · 0 评论 -
.net 正则表达式应用
public class AustraliaMobileFixing { private readonly string FullMobileFormat = @"/^04\d{8}$/"; private readonly string MobileFormat = @"/^\d{8}$/"; public st原创 2014-05-13 09:46:19 · 657 阅读 · 0 评论 -
.net webSocket例子
http://www.codeproject.com/Articles/618032/Using-WebSocket-in-NET-4-5-Part-2转载 2014-05-13 16:52:13 · 1601 阅读 · 0 评论 -
HttpClient RestFul InterFace
namespace Collinson.Http.Security{ public interface IJsonClientService { T Get(string uri); T Get(string uri, object data); T Post(string uri); T Post(s原创 2014-05-12 16:37:49 · 2091 阅读 · 0 评论 -
HttpModule
HttpHandler—— 一点一点学ASP.NET文野:2006年8月9日星期三上一篇:一点一点学ASP.NET之基础概念——HttpModule 概述HttpHandler是一个HTTP请求的真正处理中心,也正是在这个HttpHandler容器中,ASP.NET Framework才真正地对客户端请求的服务器页面做出编译和执行,并将处理过后的信息附加在HTTP请求信转载 2014-05-11 14:54:50 · 515 阅读 · 0 评论 -
WCF双工通道
http://www.lmwlove.com/ac/ID1035原创 2014-04-24 16:04:39 · 660 阅读 · 0 评论 -
preventing cross-site request forgery attack
http://www.asp.net/web-api/overview/security/preventing-cross-site-request-forgery-(csrf)-attacksCross-Site Request Forgery (CSRF) is an attack where a malicious site sends a request to a vu原创 2014-03-04 17:10:59 · 1005 阅读 · 0 评论 -
Content Security Policy
http://en.wikipedia.org/wiki/Content_Security_PolicyContent Security Policy (CSP) is a computer security concept, to prevent cross-site scripting (XSS) and related attacks.[1] It is a Ca原创 2014-03-04 17:20:31 · 4065 阅读 · 0 评论 -
先弹出对话框,然后跳转页面
string userID = this.USER_ID.Text; Page.RegisterStartupScript("a", "alert('员工:" + userID + "恢复成功');"); Page.ClientScript.RegisterStartupScript(this.GetType(), "key", @"window.location.href ='./A原创 2012-06-05 00:40:04 · 3074 阅读 · 0 评论 -
web.config数据库联接字符串的设置与读取
web.config connectionString="data source=.;Initial Catalog=DBName;User ID=sa;Password=sa" providerName="System.Data.SqlClient" /> 读取string c原创 2012-06-05 00:28:07 · 408 阅读 · 0 评论 -
GridView某一列宽度(相对于gridview外层控件)
非常简单 this.GridView1.Columns[1].ItemStyle.Width=Unit.Percentage(50);原创 2012-06-05 00:20:14 · 578 阅读 · 0 评论 -
async and await 简单的入门
async and await简单的入门如果有几个Uri,需要获取这些Uri的所有内容的长度之和,你会如何做? 很简单,使用WebClient一个一个的获取uri的内容长度,进行累加。也就是说如果有5个Uri,请求的时间分别是:1s 2s 3s 4s 5s. 那么需要的时间是:1+2+3+4+5=(6*5)/2=15.如果采用并行计算的话,结果可能是这样转载 2012-06-05 16:00:46 · 716 阅读 · 0 评论 -
实现从服务器下载文件代码
#region 下载服务器上的文件 /// /// 下载服务器上的文件 /// /// 程序中可以设置参数:HttpResponse ht=Page.Response; /// 服务器上的文件路径 public void DownloadFile(string serverPath) { FileStrea原创 2012-06-05 00:30:26 · 1321 阅读 · 0 评论 -
Repeter控件+带参数linkbutton下载
文件名称: 类型: 版本: 语言: 文件大小:原创 2012-06-05 00:26:15 · 952 阅读 · 0 评论 -
GrideView上的_RowCommand事件传值
function 1: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { !!!!! int index = Convert.ToInt32(e.CommandArgument); //获得选中的行 !!!!!原创 2012-06-05 00:15:44 · 810 阅读 · 0 评论 -
二进制判断权限
int role = masHandle.GetRoleByMemberID(str_member_badge); if ((role & 2) != 2)//没有主管权限 { for (int i = 1; i { ((Panel)t原创 2012-06-05 00:02:58 · 1315 阅读 · 0 评论 -
使用master母板页FindControl问题
((Label)this.Master.FindControl("MainContent").FindControl("current_item_gruop_pro_" + index_curr)).Text = wrcc.ProductName;在带有master的内容页中,要findcontrol 需要先this.Master.FindControl("MainContent") //M原创 2012-06-05 00:22:00 · 656 阅读 · 0 评论 -
AJAX控件学习-简单例子
用ASP.NET自带AJAX控件实现页面无刷新变色前台代码 后台代码using System;using System.Collections.Generi原创 2012-06-05 00:06:05 · 461 阅读 · 0 评论 -
DropdownList初始选中
this.ID_DEPARTMENT.ClearSelection(); //清除已选项 ListItem item = ID_DEPARTMENT.Items.FindByText(department.Trim()); //根据一个值"department.Trim()"查找是否droplist里有 if (item != null) item.Selected原创 2012-06-05 00:14:07 · 420 阅读 · 0 评论 -
gridview中radiobutton实现单选
protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { int row = ((GridViewRow)((RadioButton)sender).NamingContainer).RowIndex; //获得选中行原创 2012-06-05 00:19:25 · 563 阅读 · 0 评论 -
Cross-origin request official description on asp.net
http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-apiIntroductionBrowser security prevents a web page from making AJAX requests to another domain. This r原创 2014-03-04 17:08:58 · 1506 阅读 · 0 评论 -
OAuth
Web API----- OAuthhttp://oauth.net/code/http://www.cnblogs.com/n-pei/archive/2012/05/29/2524673.html原创 2014-01-23 10:10:40 · 629 阅读 · 0 评论 -
web API 错误处理The 'ObjectContent`1' type failed to serialize
just added this three lines in my WebApiConfig.cs file...var json = config.Formatters.JsonFormatter;json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReference原创 2013-10-28 16:24:40 · 4449 阅读 · 2 评论 -
asp.net页面生命周期
1.对象初始化(OnInit方法) 页面中的控件(包括页面本身)都是在它们最初的FORM中被首次初始化的。通过在ASPX页面的后台代码文件的构造器中声明你的对象,页面将知道对象的类型,并知道需要创建多少个这样的对象。一旦你在构造器中声明了你的控件,你就可以在它的任何子类,方法,事件或者属性中访问到它们。但是,如果你的任何对象是在ASPX文件中指定的控件,这样的控件是没有属性的。而且这转载 2013-08-22 13:35:28 · 503 阅读 · 0 评论