
Misc
文章平均质量分 53
kissjob
这个作者很懒,什么都没留下…
展开
-
C# and ASP.NET Interview Question and Answers
1. What is the significance of Finalize method in .NET?非托管资源(文件,数据库,COM)不能释放,需要手动调用object.Finalize()方法。But unmanaged resources (example: Windows API created objects, File, Database connection obje转载 2014-02-14 15:22:32 · 840 阅读 · 0 评论 -
Environment.SpecialFolder Enumeration
Differences between the Windows versionsXP/Server 2003ApplicationData: C:/Documents and Settings//Application DataCommonApplicationData: C:/Documents and Settings/All Users/Application DataCommonProgramFiles: C:/Program Files/Common FilesDesktopDirectory:转载 2011-05-31 10:32:00 · 504 阅读 · 0 评论 -
How to assign control right to specific folder
<br /><br />using System.Security.AccessControl;<br /> private void ApplyFullControlRight(string folder)<br /> {<br /> if (Directory.Exists(folder))<br /> {<br /> DirectoryInfo myDirectoryInfo = new Direct原创 2011-05-23 12:45:00 · 499 阅读 · 0 评论 -
How to create short-cut dynamically
<br /><br />using IWshRuntimeLibrary;<br />string profileNewFileName = Path.Combine(shortCutPath, @"short-cut.lnk");<br /> if (File.Exists(profileNewFileName))<br /> {<br /> File.Delete(profileNewFileName);<原创 2011-05-23 12:44:00 · 472 阅读 · 0 评论 -
How to check Win7 or 64bit environment
<br /><br />private static string ProgramFilesx86()<br /> {<br /> if (8 == IntPtr.Size<br /> || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))<br /> {<br />原创 2011-05-23 12:40:00 · 679 阅读 · 0 评论 -
How to simulate Mouse Click event
<br /><br />[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]<br /> public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);<br /> <br /> private co原创 2011-05-23 12:36:00 · 749 阅读 · 0 评论 -
多态性(C# 编程指南)
<br />1.使用 new 关键字时,调用的是新的类成员而不是已被替换的基类成员。这些基类成员称为隐藏成员。如果将派生类的实例强制转换为基类的实例,就仍然可以调用隐藏类成员.<br />public class BaseClass{ public void DoWork() { } public int WorkField; public int WorkProperty { get { return 0; } }}pub转载 2011-01-07 13:39:00 · 476 阅读 · 0 评论 -
Delegate & Expression Tree 研究
一:1.delcare a delegate:public delegate void RemoteOperation();public static void DoSth() { Console.WriteLine("DoSth"); Console.ReadLine(); }2.instantiate a delegateRemoteOperation function = DoSth;What done by Compiler automatically?1)原创 2010-11-05 13:43:00 · 738 阅读 · 0 评论 -
C# 4.0 New Feature
Covariance and Contravariance在 .NET Framework 4 中,Func 泛型委托(如 Func)具有协变返回类型和逆变参数类型。Action 泛型委托(如 Action)具有逆变参数类型。这意味着,可以将委托指派给具有派生程度较高的参数类型和(对于 Func 泛型委托)派生程度较低的返回类型的变量。(in 关键字)输入参数为逆变,(out 关键字)返回值为协变。public interface IEnumerable { /* ... */ }Notice the ou原创 2010-10-28 13:33:00 · 707 阅读 · 0 评论 -
Ten caching mistakes that break your app
小心使用你的Cache。。。http://www.codeproject.com/KB/web-cache/cachingmistakes.aspxTen caching mistakes that break your appBy Omar Al Zabir | 5 Oct 2010 | Unedited contribution Part of The Cloud Zone. Caching large objects, duplicate objects, caching coll转载 2010-10-11 17:17:00 · 627 阅读 · 0 评论 -
How to remove the VBA Project Password
Create a new simple excel file.In the VBA part, set a simple password (say - 1234).Save the file and exit. Then check the file size - see St原创 2011-07-19 14:43:59 · 613 阅读 · 0 评论 -
What is a Closure?
In computer science, a closure is a function together with a referencing environment for the nonlocal names (free variables) of that functio原创 2011-04-18 12:54:00 · 618 阅读 · 0 评论 -
字串 codepage 轉碼處理
CodePage:foreach (EncodingInfo ei in Encoding.GetEncodings()) { Encoding e = ei.GetEncoding(); Console.WriteLine("Name:{0},CodePage:{1}",ei.Name, e.CodePage); }936-gb2312原创 2014-01-26 14:27:41 · 832 阅读 · 0 评论 -
I, Interface
http://www.codeproject.com/KB/cs/i-interface.aspx一个介绍interface的好文章Let's take a simple interface and see what we can do with it. Collapse | Copy Codepublic interface ITask(){ vo转载 2012-01-05 16:02:22 · 678 阅读 · 0 评论 -
openfiledialog control locks folder
XP下在打开OpenFileDialog后,不能修改目录的名称,提示 "The action can't be completed because the folder is open in another program. Close the folder and try again."解决方法:var dlg = new OpenFileDialog; dlg原创 2011-11-09 14:33:37 · 466 阅读 · 0 评论 -
RTF Builder
http://www.codeproject.com/KB/recipes/RtfConverter.aspx在RTF中,中文等特殊字符的转换,需要添加Unicode的标记(\ucN, \uN);the current RTF Specification 1.9.1,附件:Unicode RTFFrom Word 97 onward, Word is based原创 2011-11-03 10:45:20 · 1228 阅读 · 0 评论 -
Extension Methods
Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of st原创 2011-11-01 13:57:43 · 455 阅读 · 0 评论 -
How can I get the local group name for guests/administrators?
The names of groups are localised depending on system language.For 'well known' groups like 'Administrators' and 'Guests' you should retrieve based on the SID. The SID for Guests is:S-1-5-32-546转载 2011-11-15 16:36:18 · 638 阅读 · 0 评论 -
Access to the path 'Global\.net clr networking' is denied
http://connect.microsoft.com/VisualStudio/feedback/details/387419/access-to-the-path-global-net-clr-networking-is-denied-via-ipaddress-tryparseThis issue has been fixed in the next version of原创 2011-11-15 16:47:06 · 1534 阅读 · 0 评论 -
Access to the path 'Global\.net data provider for sqlserver' is denied.
It works fine with a normal (admin) WinXP user. P.S.: I use nhibernate 1.0.2, .net 2.0, SQl Server 2005 Express Edition Solution is to ReInstall .netFrame work or SQL Server......EDIT:原创 2011-11-15 16:40:02 · 1210 阅读 · 0 评论 -
How Browsers Work: Behind the Scenes of Modern Web Browsers
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/As a web developer, learning the internals of browser operations helps yo转载 2011-08-29 09:20:23 · 2186 阅读 · 0 评论 -
ASP.NET File Upload with Progress Bar
<br />支持实时显示状态的Upload File.<br /> <br />http://www.codeproject.com/KB/webforms/FileUploadWithProgrss.aspx<br />http://www.codeproject.com/KB/webforms/FileUploadWithProgrss/FileUpload.zipIntroduction<br />File upload widget that will display real time file转载 2010-10-11 12:46:00 · 1030 阅读 · 0 评论 -
Client Ids generation with ASP.NET 4.0
<br />Asp.NET 4.0有4种ClientID的产生方法<br />ASP.NET 4.0 provides the power to control Client Ids generation. For that it provide the new property ClientIDMode property to handle this.This property enables us to to specify that, how the Client Ids will be genera原创 2010-09-13 09:27:00 · 685 阅读 · 0 评论 -
禁止 在Text Box 里面Copy & Paste, Autocomplete
比如输入密码时,需要禁止Copy, Paste,Cut,Autocomplete等。((TextBox)this.Page.FindControl("ctl00$Tool$btnLogin$Password")).Attributes.Add("oncopy", "return false;");((TextBox)this.Page.FindControl("ctl00$Tool$btnLo原创 2009-10-26 09:08:00 · 781 阅读 · 0 评论 -
CSS Differences in Internet Explorer 6, 7 and 8
http://www.smashingmagazine.com/2009/10/14/css-differences-in-internet-explorer-6-7-and-8/一篇讨论在IE6, IE7 & IE8 下CSS 区别的文章。 One of the most bizarre statistical facts in relation to browser use has转载 2009-10-16 09:04:00 · 1265 阅读 · 0 评论 -
Solution For "could not be located or a different control is assigned to the same ID after postback"
近来在多语言实现里面,遇到了这样的错误:An error has occurred because a control with id grdComplaints$ctl04$ctl00 could not be located or a different control is assigned to the same ID after postback. If the ID is no原创 2009-09-23 09:29:00 · 1199 阅读 · 0 评论 -
“Invalid postback or callback argument” in ASP.NET 的解决办法
Normal 0 false false false MicrosoftInternetExplorer4 <!-- /* Style Definitions */ table.MsoNormalTable {mso-st原创 2009-09-11 17:24:00 · 2852 阅读 · 0 评论 -
ASP.NET Page Life Cycle - 1
This article describes the ASP.NET Page Life Cycle from the moment the URL is hit from the web browser till the HTML code is generated and sent to the web browser.http://www.codeproject.com/KB/aspne转载 2009-09-09 21:40:00 · 829 阅读 · 0 评论 -
ASP.NET TextBox Support KeyPress Down Event
直接按回车键,然后进行查询功能。txtSearch.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById(" + this.btnSearch.UniqueID + ").原创 2009-09-04 16:50:00 · 1059 阅读 · 0 评论 -
Unified Multi-Language Solution
简单总结一下.NET多语言的一揽子解决方案1.根据ASP.NET Page,点击Tool->Local Resource,使得自动产生Local Resource。2.然后把所有的Local Resource合并到一个Global Resoure File。3.调用Goolgle.Translation API/DLL,自动进行翻译,得到你想要得语言Resoure File4.实现原创 2009-08-20 20:41:00 · 540 阅读 · 0 评论 -
How to build Multi-Language Web Sites with ASP.NET 2.0 and VS.Net 2005
Introduction:In order to reach international markets through the Internet,supporting different cultures through our applications is essential forbeing successful. The .NET Framework转载 2009-08-11 16:09:00 · 580 阅读 · 0 评论 -
支持加密 Web.config 文件的节 以及如何部署
1. 加密命令:C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/aspnet_regiis -pef "connectionStrings" "D:/Project/WebSite1" 2. 解密命令:C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/aspnet_regiis -pdf "c原创 2009-05-14 17:04:00 · 491 阅读 · 0 评论 -
Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it
http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx Simplest solution: %@Page EnableEventValidation="fals转载 2009-11-06 13:00:00 · 491 阅读 · 0 评论 -
How To: Prevent Cross-Site Scripting in ASP.NET
这篇文章讨论了,如何在ASP.Net防止Cross-Site Scipting攻击。有些地方还是值得借鉴的。 http://msdn.microsoft.com/en-us/library/ms998274.aspx 两条基本原则:1)限制输入2)加密输出主要步骤:Step 1. Check that ASP.NET request validation is翻译 2009-10-29 19:47:00 · 616 阅读 · 0 评论 -
ASP.NET authentication and authorization
http://www.codeproject.com/KB/aspnet/ASPDOTNETauthentication.aspx转载 2010-08-10 09:03:00 · 3178 阅读 · 0 评论 -
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide
http://www.codeproject.com/KB/cs/MasteringInDebugging.aspxTable of ContentsIntroduction How to Start? Breakpoints Debugging with Breakpoints Step Over Step Into Step Out Contin转载 2010-05-11 09:32:00 · 1177 阅读 · 0 评论 -
ASP.NET application and page life cycle -2
http://www.codeproject.com/KB/aspnet/ASPDOTNETPageLifecycle.aspx?msg=3443071#xx3443071xx ASP.NET application and page life cycle IntroductionThe Two step processCreation of ASP.NET environmen转载 2010-04-19 09:40:00 · 935 阅读 · 0 评论 -
ASP.NET防止文件被下载和查看
包括以下几种情况1. 使用 ASP.NET 来保护文件类型(绝对不允许用户下载/查看)http://support.microsoft.com/kb/815152默认状态下,ASP.NET 被配置以截获并停止在 ASP.NET 应用程序中使用的几种不同的文件类型的请求。这些文件类型是那些不会检索的用户。这些文件类型包括存储的应用程序和.cs 文件存储在应用程序的源代码的配置信息的.co原创 2010-03-29 09:23:00 · 5132 阅读 · 0 评论 -
Tips and Tricks for the Visual Studio .NET IDE
工欲善其事,必先利其器.介绍Visual Studio .NET IDE的常用的快捷键.1.IntelliSenseCtrl+J,显示完整列表.2.NavigationCtrl+- i.e. Ctrl + Hyphen.回到你之前浏览过的代码Ctrl+Shift+- 和上面的相反.F12, 查找该符号定义的位置,比如函数的申明.Shift+F12,显示所有引用过此符号的原创 2010-03-18 09:11:00 · 367 阅读 · 0 评论 -
文件名是否合法的操作(Path.GetInvalidFileNameChars())
char[] invalidFileChars = Path.GetInvalidFileNameChars(); foreach (char c in invalidFileChars) { if (attachment.FileNam原创 2009-12-03 11:12:00 · 1872 阅读 · 0 评论