Thursday, October 30, 2014
Tuesday, October 28, 2014
Friday, October 24, 2014
Why singleton is so bad
http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons
What is common example/scenario we need to initialize only one object?
What is common example/scenario we need to initialize only one object?
Thursday, October 23, 2014
How solve problem: Get HTTP Error 401.1 - Unauthorized error with Windows Authentication and f5 host name binding only
#1: Need to add local machine host name into binding as well
#2: Disable loopback for IIS
References:
http://support2.microsoft.com/default.aspx?scid=kb;en-us;896861
http://stackoverflow.com/questions/5180851/iis-binding-with-windows-authentication
About loopback for Reflection attack
http://en.wikipedia.org/wiki/Reflection_attack
#2: Disable loopback for IIS
References:
http://support2.microsoft.com/default.aspx?scid=kb;en-us;896861
http://stackoverflow.com/questions/5180851/iis-binding-with-windows-authentication
About loopback for Reflection attack
http://en.wikipedia.org/wiki/Reflection_attack
Wednesday, October 22, 2014
Tuesday, October 21, 2014
Wednesday, October 15, 2014
How to check temp table exist in MS SQL Server?
IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL
DROP TABLE #TempTavle
DROP TABLE #TempTavle
How to write error information into MS SQL Server log?
DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end
How to check exists file in MS SQL server
DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end
Friday, October 10, 2014
Thursday, October 9, 2014
If url includes Dot/Period, will cause 404 error for ASP.NET routing
Need to change web.config setting at:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
Enable hotlinking on Bayimg
I made a tool to upload image to bayimg and get raw image url right way:
http://bayimghelper.apphb.com/
But Bayimg blocks hotlinking. So write a function to enable it.
For example:
Original Bayimg link:
http://image.bayimg.com/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg
You can use following to get access this image
http://bayimghelper.apphb.com/i/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg
The source code is located at:
https://github.com/raysaspnet/bayimghelper
http://bayimghelper.apphb.com/
But Bayimg blocks hotlinking. So write a function to enable it.
For example:
Original Bayimg link:
http://image.bayimg.com/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg
You can use following to get access this image
http://bayimghelper.apphb.com/i/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg
The source code is located at:
https://github.com/raysaspnet/bayimghelper
How to prevent image hotlinking in ASP.NET?
In IIS Server by URL rewrite:
http://www.it-notebook.org/iis/article/prevent_hotlinking_url_rewrite.htm
http://www.it-notebook.org/iis/article/prevent_hotlinking_url_rewrite.htm
Monday, October 6, 2014
Subscribe to:
Posts (Atom)