This blog is now moved to http://syedgakbar.com
Please visit the above site for details and latest updates.
This blog is now moved to http://syedgakbar.com
Please visit the above site for details and latest updates.
Posted in Uncategorized
With growing security concersn for the site, it’s now recommended to don’t use the Weak or No Ciphers at all. Unfortunately, these weak ciphers are enabled by default in most of the IIS versions.
If you don’t want to supports the use of SSL ciphers that offer either weak encryption or no encryption at all, then you can easily turn them of by by modifying the corresponding registry entries under following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\
Basically, to fix this security warning, you should disable the SSLv2 and any SSL Ciphers less than 128 bit encryption.
The following link discuss the steps you need to perform:
http://blog.techstacks.com/2008/10/iis-disabling-sslv2-and-weak-ciphers.html
If you want more info or details, please check the following link:
http://support.microsoft.com/kb/187498
As it’s risky task, I will recommend that you first try it on a test machine.
Good luck and be careful when editing registry entries.
As I discussed in my previous thread, more and more people and moving toward the Tableless design to design the HTML files. Check the following post for detail:
http://syedgakbar.wordpress.com/2008/03/01/a-step-toward-tableless-design/
Of course, the migration is not as simple as it looks. Designing the page layout with just the DIVs (basically not using tables) is not that easy for newbies. There are many tricks and tweaks you learn with time (similar to what it was with table based design). One question I asked frequently is that how you can center align the DIV tag using the stylesheet. The reason for this the trick to do this using CSS is not that intutive. You may start with “text-align:center”, or by doing “float:left”, but all this doesn’t work. The correct way to do this using something like this:
<div style="margin:0 auto;width:930px;"> Center Aligned Box </div>
In the width, you can give it either by percentage (to make it relative to current page width) or in pixel (hard coded). There is still one small catch. Sometime you will notice that it doesn’t work in the IE. The most probable reason is that IE is running in the Quirks Mode
To fix this, add the following line which set the DOCTYPE to restrict:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Hope it helps.
Posted in CSS, HTML | Tags: DIV Center Align IE
One of our client reported a problem that on some of their site secure pages FireFox displays the “connection partially encrprypted warning” (by showing a small “i” on secure lock icon).
When I first started looking at that problem, I thought it would be something as simple as some page being hosted on the HTTP (using hardcoded URL). I started by looking at the page source in the FireFox page source viewer. As I start looking into it, my head started to spin because looking at the page source (HTML) all the path were either relative or were on HTTPS.
After spending sometime and carefully observing the pages, I found a pattern that the pages with the ASP.Net form and text box controls usually result in this SSL warning. After this clue, I run the HTTP Analyzer and found the issue (I wish I had run it earlier, but it’s never too late). The problem I found was the “WebResource.axd” is being return at the HTTP path. Actually, it’s requested at the HTTPS path, but then the server sends a redirect command to request this file over the HTTP and it causes this warning.
After finding this, I searched with related keywords, and I found a blog which discuss the same problem in much more detail:
http://blogs.msdn.com/praveeny/archive/2007/03/27/webresource-axd-going-over-http-when-you-are-browsing-on-https.aspx
The solution was simple. The client was using a custom ASP.Net Handler to toggle between the secure and non-secure modes. http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx
All which was needed to fix the problem was to allow the “WebResource.axd” to be served on the HTTPS too.
The point is when you see such problem, don’t rely on the simple page source. Rather look at the actual HTTP packets (using tools like HTTP Analyzer, Fiddler, etc) and you can solve such problem in minutes.
When debugging some problem, usually the “Call Stack” window is really of help. It let’s quickly see how you reached in current location i.e. call chain. This is of help when using some Visual Debugger, but you know what, the actual error happens when the application goes Live. For live applications, a good practice is to always log these errors in some database (or file) for latter analysis.
In .Net, during the runtime exception logging, most of us will use the Exception.StackTrace property to log the current stack trace. During analysis of different run-time errors, I found that some time the Exception.StrackTrace doesn’t return the full call chain. I think this is related to the classes which override the StackTrace property for content or format control.
Anyway, the good thing is that you can get full call chain, including the system calls, using the Environment.StackTrace. Though it’s large, but what it has is worth the bytes it consumes. Another advantage of the Environment.StackTrace property it works even when no exception has occurred.
Posted in .Net Framework, C# Tips, Windows | Tags: .Net, call chain, Call Stack, Environment
When developing a desktop application, it’s often required that only one instance of application should be executable at a time. This is usually implemented in different ways depending on Language/Tools you are using to build the application.
Some common techniques used are either using the Mutex or getting a list of active processes and making sure that a process with same executable name is not already running. Here are the different articles which all discuss a bit different techniques to achieve the same goal:
http://dotnet.org.za/ernst/archive/2004/07/20/2887.aspx
http://www.codeproject.com/KB/cs/CSSIApp.aspx
http://www.ddj.com/windows/184416856
http://audiprimadhanty.wordpress.com/2008/06/30/ensuring-one-instance-of-application-running-at-one-time/
If you are developing your application in Visual C++, then there is a relatively simple and straight forward method. The trick is that you declare a shared segment for you executable and you set a variable in the shared data segment when the first instance of the application is run. When you try to run again the same application, it also shares the same data segment and thus you can check the value of the variable to see if another instance of application is running or not.
For this you can add the following code at top of your executable.
// This share data segment section is used to make sure that only instance of the application
// should be running at a time
#pragma data_seg(“.singleInstance”)
HWND g_hWnd = NULL;
#pragma data_seg()
#pragma comment(linker, “/section:.singleInstance,rws”)
Then you can check and set the g_hWnd in your Instance initialization method.
// Check if another instance of the application is already running
if (g_hWnd)
{
// Post message to bring the main window to front
// Another instance is already running, so quit.
return false;
}
Don’t forget to assign the “g_hWnd” variable the reference of main window handle after you create that window. Credit for this technique goes to:
http://www.codeguru.com/cpp/misc/misc/applicationcontrol/article.php/c3763/
Posted in Win32 API, Windows | Tags: application, mutex, run, shared data segment, single instance
<div style=”page-break-before:always”>This will print on first page</div><div style=”page-break-before:always; page-break-after:always”>This will print on second page</div><div>This will print on third page</div>
Posted in HTML & CSS | Tags: CSS, HTML, Page break