July 2009 - Posts
DOM Inspector Tool in FireFox
Just was trying out FireFox (same as Netscape family, I hope).
It has a real cool tool embedded called DOMInspector, which aides in inspecting the DOM Structure of the URL that is being viewed.
Check out FireFox at: http://www.mozilla.org/products/firefox/
/* Migrated from Daffodilnet Express -- posted on December 3, 2005 */
Working with System.Web.Mail namespace...
We use System.Web.Mail namespace to send emails from our .NET Applications. It uses two main classes called MailMessage and SmtpServer. The latter having a single static property to indicate the email server (smtp host) to use and a public method taking an instance of MailMessage carrying the mail to be delivered.
Internally it is supposed to be a wrapper on the CDO Object and lot of P/Invoke stuff being builtin, the exception stack too can be significantly larger. Quite interestingly, there is one website called http://www.systemwebmail.com/ which I would like to share with the readers which discusses at length, System.Web.Mail namespace, FAQ etc.
/* Migrated from Daffodilnet Express -- posted on 11th December 2005 */
Managing Remote Terminal Sessions -- The Easy Way
Windows 2000 brought in an elegant way of working on remote desktops by the concept of Terminal Services. But it was an additional Windows component that needed to be installed and configured, which meant additional license costs and administerial functions to setup and followup. However, it did gain in a perspective that the dependency on a third party application be it commercialware (like pcAnywhere etc) or an opensource (VNC, RealVNC etc) was broken down.
Windows XP took this one step ahead with the concept of Remote Desktop by way of RDP protocol. However, it allowed only one user to work on the system, transferring the control appropriately.
I have been using Windows 2000 Terminal Services for a long long time and one daunting and nightmarish problem that I had to face is that to ensure that users logoff rather than disconnect. When you disconnect a session, Windows Terminal Services remembers this and prevents any new users from opening a connection unless the free sessions are available. The default session count, I guess, is 2 for Windows Terminal Services.
Last week, while casually surfing the web, I came across two nice tools to manage this scenario:
- qwinsta.exe: Displays information about Terminal Sessions
- rwinsta.exe: Resets the session subsystem hardware and software to default values. Effectively, you can use this tool to reset disconnected users so that other users can login.
From a developer's perspective, I feel, that we can have a simple Windows Form application in C# to manage these. Perhaps this weekend, I would try to get a small application and publish it over my personal website for other readers' use.
From C#, we just need to use WTSAPI32.dll using DllImport to manage the functionalities of QWInsta and RWInsta. More information about this tool over here:
/* Migrated from Daffodilnet Express -- posted on January 1, 2006 */
Developing Applications for the Web is a breeze with Internet Explorer Developer Toolbar...
Debugging a web application, particularly its HTML counterpart like image path, Stylesheet, Scripting and design template issues has always been a nightmare for web developers and this always never fails to spark off arguments between the designers of the team, who would be stubborn for look and feel and developers reluctant to apply apprehending the implementation difficulties and browser compatibility issues.
There had been little tools to this perspective from various vendors like DOMInspector from Mozilla FireFox, MyIE2 had its own Scripting Inspector.
Now you can check out an Internet Explorer Developer Toolbar from Microsoft, which is available from this URL: http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en.
However, please take note of the following:
- The Toolbar is still in BETA stage.
- The Toolbar gets installed only if IE 6 is installed.
/* Migrated from Daffodilnet Express -- posted on February 22, 2006 */
Clearing IE Cache
Cache -- the five letter buzz word remains as a double-edged sword. System Administrators and Network Administrators appreciate it and recommend it for simple reason, that network bandwidth is conserved. Developers, to an extent blame it since sometimes Old data crops up.
There has been a lot of programmatic options we stipulate from our webpages to clear cache like Pragma, Cache-Control directives.
Here comes one solution from Microsoft called ClearCache. Check it out at: http://www.microsoft.com/downloads/details.aspx?familyid=5CBD4659-3B28-4801-8729-05335902CE79&displaylang=en
/* Migrated from Daffodilnet Express -- posted on February 2, 2006 */
Access to the path containing 'hash.web' is getting denied.
After installing Visual Studio .NET and F5 a couple of times, I used to get this error frequently. The only resolution was to wait for upto 5 to10 mins or restart system, since a folder in Temporary ASP.NET files containing web.config gets locked up automatically.
After searching a while in KBs, Forums, I found one closest matching solution, which solved my problem. Just wanted to share with other readers who would also be experiencing this issue. The problem occurs significantly if you touch web.config and ASP.NET has significant memory consumption (as seen in Windows Task Manager)
There is a service called Indexing Service which runs in the system. During F5, ASP.NET tries to JIT compile the new dll (as my understanding goes) and when simultaneously ASP.NET and Indexing service goes to the specified set of cache files, the deadlock occurs and ASP.NET throws this exception.
- Keep Indexing Service Manual or Stop It
- In Indexing Service Preferences, Make C:/Winnt/Microsoft.NET to be excluded or placed in the exclusion catalog so that Indexing Service will not access this location.
/* Migrated from Daffodilnet Express -- posted on October 15, 2004 */
Time Synchronizations in Windows
Recently one of my components that I was developing was DateTime driven and hence I had to change system time to see its behavior for different periods. The problem is that, you need to be very careful with changed system times, particularly when you checkin the file to SourceSafe, SendMails since a wrong time means total chaos for these systems.
For these, I choose to have a simple batch file to syncrhonize time with the SourceSafe database itself. It just goes like this:
net time \\mysourcesafeserver /set /y
net time \\mysourcesafeserver queries the time on the server
/set sets the time on the localhost to the time on the server (This will wait for a prompt of confirmation from the user, which can be avoided by appending a /y to the command)
But I have a question. Perhaps if some sysadmin drops by this post, he can put a comment and solve this so that it will be useful to other readers.
- What happens if the logged on user does not have privileges to set time? He is getting Access is denied.
- With Windows XP (Time Synchryonization) itself, will the problem in (1) get solved?
- To query net time \\mysourcesafeserver one must be logged on to \\mysourcesafeserver previously either my remembered network connection or previous manual logon? Is there any other solution for this?
But I hope the above batch file would be useful to many developers playing with and developing DateTime driven components.
/* Migrated from Daffodilnet Express -- posted on October 15, 2004 */
Quick Shortcut to Lock Workstation
We normally use QuickLaunch bar in System Taskbar for almost any of our tasks. When we want go away from our system, we normally lock the workstation. Just a curious tip. A simple two three lines of code in C# can place a nice application whose shortcut can be placed in QuickLaunch bar to Lock the Workstation.
public static extern void LockWorkStation();
static void Main(String args)
catch (Exception ee)
Alternatively,if you put the code in Windows Form and you can customize the App.ICO to some friendly ICO file which will showup in QuickLaunch bar instead of the old rectangle which shows up for an EXE.
/* Migrated from Daffodilnet Express -- posted on October 15, 2004 */
Protecting EmailAddresses on Websites
Email addresses like firstname.lastname@example.org (and these patterns) are sure to invite spammers to get your addresses on to their spam databases. Just found out the following URL, which will help you to protect your email address from being spammed.
/* Migrated from Daffodilnet Express -- posted on October 14, 2004 */
Most of us, who are using multiple SQLServer connections from our applications need to remember the connectionstring to be replaced in web.config to test the application with the different SQLServers. Either each and every time, we need to type the connectionstring parts. I just thought, I could start out writing a simple web application which could create the connectionstring from the Microsoft-provided DataLinks tool and then it can save the connectiongstring to a text file with a specific extension like .scn (Saved Connection Strings). Currently it saves one connectionstring per file, since I felt that would be easy. The other flexible options could be save all bunch in an XML file or as an Registry Entry.
Currently I have included the following basic options in the utility:
- Creates a new connection string, sets the item in the system clipboard and prompts to save it to a location.
- Edits an existing connection string , sets the item in the system clipboard and prompts to save it to a location.
- Double-clicking the .SCN file automatically launches the Edit action for the connectionstring and then the control flow resumes normally.
- Optionally, keep all connectionstrings in Registry.
- As an addon, encrypt the connectionstring and save it, to enable secure saving of confidential database login credentials.
I would try to upload the utility tonight to my Daffodilnet workspace and then update the URL here.
/* Migrated from namespace LavanyaDeepak -- posted on September 13, 2005 */
PDF in .NET
A newer and a good utility assembly, which I found, which could manage and generate PDF documents on the fly with simple code in C# and .NET. Check out http://itextsharp.sourceforge.net/ . It just contains a simple DLL that need to referenced from your solution, which does all the magic.
/* Migrated from namespace LavanyaDeepak -- posted on November 2, 2005 */
Automating Remote Desktop Web Connection
Remote Desktop (Terminal Services) is a very useful tool that ships with Windows XP. Actually it is also available, AFAIK, in Windows 2000 also but I think there it needs to be downloaded, configured and managed separately and I think there is a separate interface called 'Terminal Services Manager' over there. It also incurs a separate license. The Remote Desktop Client which gets shipped in Windows XP also has the capabilities of saving the connection details in a separate file in desktop or wherever and when you double click it, it would automatically launch the session for you.
For Windows 2000 Workstations, which do not have this Client, we can download Remote Desktop Web Connection from Microsoft. The installer would automatically configure a virtual directory and the default one http://localhost/tsweb/ would open up a page with an RDPClient ActiveX Control which emulates the behavior of the Client Application.
- Create a URL shortcut file with the URL having the following value: http://localhost/tsweb/Default.htm?srv=deepak&res=0&ac=Y&uN=lavanyadeepak&dN=deepaknetwork
- srv -> ServerName to connect
- res -> Default Resolution [0 FullScreen]
- ac -> Autoconnect (Y)
- uN -> userName
- dN -> domainName
- Now open tsWeb/default.htm in your notepad and append the following script at the end of the page, preferably before the closing body tag:
if (self.location.href.indexOf("?") > -1)
var strQueryString = self.location.href.substring(self.location.href.indexOf("?")+1);
var arrQueryStringsParts = strQueryString.split("&");
for (var intCount=0;intCount < arrQueryStringsParts.length;intCount++)
var qryPart = arrQueryStringsParts[intCount].split("=");
document.getElementById("editServer").value = qryPart;
for (var intOptCount=0;intOptCount<document.getElementById("comboRes").options.length;intOptCount++)
if (document.getElementById("comboRes").options[intOptCount].value == qryPart)
document.getElementById("comboRes").options.selectedIndex = intOptCount;
if (document.getElementById("comboRes").options.selectedIndex < 0)
document.getElementById("comboRes").options.selectedIndex = 0;
document.getElementById("Check1").checked = (qryPart=="Y");
document.getElementById("tableLogonInfo").style.display = "block";
document.getElementById("editUserName").value = qryPart;
document.getElementById("editDomain").value = qryPart;
//If valid entries found, then connect...
if (document.getElementById("editServer").value != "")
window.onload = AutoStart;
That configures your RemoteDeskop Web Connection page to relatively extend its features further.
/* Migrated from namespace LavanyaDeepak -- posted on August 11, 2005 */
Any developer using ASP.NET and VS.NET IDE would have experienced issues with Cache Folder of ASP.NET, VSWebCache having mismatched versions and hence breakpoint not getting hit. We normally use tricks like clearing it manually
This weekend, I was relatively free and thought I would get some practice on Windows Forms in .NET. I made a small application in Windows Forms and nicknamed it Dr. IIS.
I have tried addressing the following issues:
- Recycle ASPNET Worker Process (currently it detects aspnet_wp as processname. We need to generalize it to w3wp for Windows 2003)
- Restart W3SVC Service
- Purges IDE Cache (VsWebCache)
- Detects first any Visual Studio .NET instances are running. If yes, this option is disabled and a button appears to close existing Visual Studio Instances and then the checkbox gets enabled.
- Purges Temporary ASP.NET Files from the default version of .NET Framework
- Pause Indexing Service
- Also checks whether the logged on user is Administrator. If the user does not have administrator privileges, then the application exits.
I understand that there are lot of scope of improvements to this. Perhaps my next TODO in this would be:
- Generalize Detection of Worker Process (ASPNET for IIS 5.1 or lower and W3WP for IIS 6)
- Threaded Application Model
- CommandLine or Silent Mode
- Detect and Customize the application to the configured .NET Framework (in case multiple versions exist)
- Selectively add the required folders to Indexing Service Catalog for exclusion from Indexing.
I would keep updating it in my personal workspace and would publish the URL here. Please do send me your suggestions and improvements for the same.
The current download URL is http://www45.brinkster.com/daffodilnet/tools/driis.aspx
/* Migrated from namespace LavanyaDeepak -- posted on August 7, 2005 */
Automated EventLog Clearing and Backup Tool
Developers writing Windows Services would normally heavily use Windows EventsLog to log messages from the application to System,Application, Security etc builtin logs or to custom log sources too. During development the amount of messages getting logged would be enormous and sometimes during development and testing, we normally and frequently right click clear individual logs before re-running the service again.
I just thought instead of repeatedly doing this, let us put a small Windows Application, enumerate all the available System Logs. The user has to simply run the application, select the logs he wants to clear, and hit clear button.
Out of my own interest, I wanted to get some feel of GUI tricks in Windows Forms like ProgressBar and have used some tricks like ThreadPool to update the parent thread to update it. Tonight I would try to upload to DaffodilNet page at
There are lot of scope of improvement of this tool. Perhaps significant points to improve upon are:
- Backup target to EVT (EventLog Native File). I am trying to explore the feasibility with WMI Api in .NET like the ones in System.Management namespace.
- Security Checks. If a non-administrative user loads, then instead of attempting the thread and crashing it can proactively say 'Not all sections of the application are executable by the logged on user, since it needs additional administrative privileges'. Remember, when you run Disk Administrator in Control Panel -> Administrative Tools -> Computer Manager, you see this alert.
- Perhaps if you have some suggestion, do send me. I would try to incorporate it.
/* Migrated from namespace LavanyaDeepak -- posted on July 30, 2005 */
I was trying to figure out what are the dependencies for a OCX file which I was trying to package. Since I had only Visual Studio .NET in my system, I did'nt have a Dependency Walker (depends.exe).
A brief search in Google revealed this website http://www.dependencywalker.com/ which is the same tool that gets shipped with Visual Studio 6.0. I wanted to share this with my readers of the blog too for their use and reference.
/* Migrated from namespace LavanyaDeepak -- posted on July 29, 2005 */
Elegant Classification in Dropdown Boxes
Dropdown boxes are part of any common webpage. When there are more number of values, then it would be harder to read and would be very unfriendly to the user at large.
One of my friend was asking some trick to workaround this issue and I was suggesting him some XmlHttpRequest and other trick to load it in piecemeal fashion. And accidentally, I discovered a nice trick in HTML called OPTGROUP.
India Pakistan Turkey Australia New Zealand
The elegance of this structure is that the Label Captions are skipped by the web browser automatically and you can apply different coloring for the group.
/* Migrated from namespace LavanyaDeepak -- posted on June 30, 2005 */
QueryExpress -- Tool for Database Updates
A little neat tool from http://www.albahari.com/ which facilitates you to connect to SQLServer, Oracle or any OLEDB Compliant databases. Furthermore, it comes with its source code availability. Its salient features being Threading and Async QueryExecution, plain vanilla XML serializing of connection details and introducing developers to use TypedDataSet.
It was an interesting coincidence that I got to know of QueryExpress sometime about 3 years ago, when we were in a small organization in Chennai executing a portfolio management project for a client based in California. The database was IBM DB2 and there were no friendly database connector tools and the then ignorance of us in DB2 made us very desparate and discouraging.
A brief search in Google revealed this nice tool. This has enthralled me so much. Even me, nowadays try to update the source, to keep it as a supreme product.
Here are the links to QueryExpress:
- QueryExpress home on http://www.albahari.com/ : http://www.albahari.com/query express.html
- QueryExpress with ODBC Support: http://www45.brinkster.com/daffodilnet/queryexpress.aspx
Do send us suggestions on what you would like to see in QueryExpress...
/* Migrated from namespace LavanyaDeepak -- posted on July 15, 2005 */
Free Digital Certificates
When we test SSL or Cab Files, if we have a digital certificate, then it would be a full-length testing. Check out the following websites that give free certificates:
Just wanted to update. There is a tool called SSLDiagnostics from Microsoft Website. Here is a brief description from MSDN on this tool:
SSL Diagnostics Version 1.0 helps you identify configuration problems in the IIS metabase, certificates, or certificate stores when running Web sites that use SSL. This tool allows you to review SSL configuration information, simulate the SSL handshake to locate errors, or "hot swap" certificates for testing purposes -- http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f2c980d6-a802-419f-9227-ab46f570c223.mspx
Here is the download URL for SSL Diagnostics:
I hope this would be very useful for developers of web applications whilst testing SSL-enabled applications.
/* Migrated from namespace LavanyaDeepak -- posted on June 10, 2005 */
SQLServer and UDFs
UDFs are a cute little things in any database. Just use them in a query and you can loop through the tables and find out without the application bothering about requerying etc.
But in SQLServer, I experienced this glitch. When we created the UDF, it has to be called as owner.functionName unless it is a system defined function.
In our application, we had a generic data access component targetting multiple databases namely three as of now. So this was presenting a piquant situation.
After a deal of small R&D, I found out some of the following workarounds for this:
- Have the application discover the owner and prefix the same. This being similar to a metadata query, will need a roundtrip to the database. May be as an optimization, we can have a Caching other than for the first request.
- After the initial seed data has been run for the database, by the setup scripts, make sure that you also reset all owners to the negotiated user login. You can use the system defined stored procedure
sp_changeobjectowner @objName='GetAppPath', @newowner='lavanya'
/* Migrated from namespace LavanyaDeepak -- posted on October 10, 2004 */
Windows Services -- Breeze to develop in C#
Developing Windows Services is no longer a nightmare, thanks to friendly .NET BCLs, beloved VS.NET Intellisense. But during development, due to errors, we might need to manage the SCM database directly like deleting the Windows Service and that too, without having the assembly on hand, which is impossible using InstallUtil.exe.
I have developing a Scheduler Service for our application and this was a hurdle for me. Fortunately, I came across this tool called SC.EXE available from Microsoft itself.
It comes with nice documentation at: http://msdn.microsoft.com/library/en-us/dndllpro/html/msdn_scmslite.asp?frame=true
Somewhere else, I got a nice downloadable Word document also. I would search again and try to update the same too here.
/* Migrated from namespace LavanyaDeepak -- posted on October 18, 2004 */
More Posts Next page »