Skip to main content

Posts

Showing posts from 2007

CDO.message creation failes with "System.Security.SecurityException was unhandled"

"System.Security.SecurityException was unhandled" error appears during creation of CDO.Message object. CDO.Message msgTemp = new CDO.MessageClass(); The error above happens when I tried to run windows forms application from the network drive (default VS projects locations). This was solved only by moving whole project to the my local drive.

Run T-SQL Script from Batch File

The simple way to run T-SQL script from batch file is using SQLCMD command. It's can be useful to run repeatable tasks like backups or restores. Basic syntax is: C:\Windows> sqlcmd -S SERVERNAME -o "OUTPUT_FILE.TXT" -U sa -P PASWORD -i C:\MySCRIPT.sql Following article have more detailed information: Using the SQLCMD command line utility for SQL SERVER

Memory Leak Detection: Methods and Tools

Following are two articles the explains in the examples how what to do if you .Net application creating memory leak. Memory Leak Detection in .Net .NET Memory Leak: XmlSerializing your way to a Memory Leak In general is: 1. Use performance monitoring to initial analisys 2. Use WinDbg tool from Microsoft to identify the real problem (assembly)

Open VS 2005 Web Site from Windows Explorer

If you are using Visual Studio web site to develop your web application you are probably fanilar with following situation. You found inside the Windows Explorer in the place where project is stored but to open project (web site) you needed to go to the Visual Studio and again to locate the folder. Following link is a good and very simple solution that allow your to open web site projects by right click on the project folder inside Windows Explorer or other file manager.

Reflector for .Net - amaizing how open your .Net source code

Reflector for .Net - Reflector is the class browser, explorer, analyzer and documentation viewer for .NET. Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies in C#, Visual Basic and IL. At same site there are also other interesting tools like: Resourcer for .NET - Resourcer is an editor for .resources binaries and .resX XML file formats used with the .NET platform Mapack for .NET - Mapack is a .NET class library for basic linear algebra computations.

Sniffer Software (Free)

Open source sniffer software - http://www.securesphere.net/html/projects_sniphere.php Sniphere is an another network wiretapping program for Windows using winpcap. Nevertheless, Sniphere is a pretty handy program with a lot of possibilities which most of free sniffers do not have.

Use SQL Server to Analyze Web Logs

Link that shows how to use the SQL Server to analyze IIS log file. http://support.microsoft.com/kb/296085 In general: 1. Create table in the database CREATE TABLE [dbo].[tablename] ( [date] [datetime] NULL, [time] [datetime] NULL , [c-ip] [varchar] (50) NULL , [cs-method] [varchar] (50) NULL , [cs-uri-stem] [varchar] (255) NULL , [cs-uri-query] [varchar] (2048) NULL , [sc-status] [int] NULL , [sc-bytes] [int] NULL , [time-taken] [int] NULL , [cs(User-Agent)] [varchar] (255) NULL , [cs(Cookie)] [varchar] (2048) NULL , [cs(Referer)] [varchar] (2048) NULL ) 2. Import log file using the bulk Insert function BULK INSERT [dbo].[tablename] FROM 'c:\weblog.log' WITH ( FIELDTERMINATOR = ' ', ROWTERMINATOR = '\n' )

Must To Have Utilities

FileMon - FileMon monitors and displays file system activity on a system in real-time. Note: Filemon and Regmon have been replaced by Process Monitor on versions of Windows starting with Windows 2000 SP4, Windows XP SP2, Windows Server 2003 SP1, and Windows Vista. Unlocker - The solution for "Cannot delete file: Access is denied" error message. Dependency.exe - Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. SCDL version 1.1 - Generates source code for config sections based on an XML sample, also creates the XSD schema for the section. Expresso - Regular Expression Editor and Tester

T-Sql: Error Handling Solution

The following code can be the simple solution for error handling problems in the SQL Server: Declare @ErrorCode int Select @ErrorCode = @@Error If @ErrorCode = 0 Begin --Some statement Update … Select @ErrorCode = @@Error End If @ErrorCode = 0 Begin --Another statement Insert … Select @ErrorCode = @@Error End If @ErrorCode = 0 Begin --Another statement Update … Select @ErrorCode = @@Error End Return @ErrorCode More information: http://msdn2.microsoft.com/en-us/library/aa175920(SQL.80).aspx

Improve DataView Performance Tip

Following tip will allow your to increase your performance when your are using DataView RowFilter property. Just instead of using following syntax: DataView dv = new DataView("tableName"); dv.RowFilter = "Name like '%blabla%'"; Use the next one (combine it to single statement): DataView dv = new DataView( TableName, "EName like '%Test%'", null, DataViewRowFilter.CurrentRows ); This will improve your performance !!! It's real.

Sending E-Mail (.NET 2.0)

The System.Net.Mail namespace contains all the classes required for sending mail from within a .NET application. The SmtpClient class handles the actual sending of e-mail. For a simple mail, you can directly pass in the To address, from, subject, and body of the mail to one of the SmtpClient's overloaded send methods. Client application: private void btnSendMail_Click(object sender, EventArgs e) { MailService service = new MailService(); string from = "some@yahoo.com"; string to = "some@yahoo.com"; string subject = "Sending EMails from .NET 2.0"; string body = "Message Body"; service.SendMail(from, to, subject, body); ; MessageBox.Show("Done"); } Sending method: public void SendMail(string from, string to, string subject, string body) { string mailServerName = "yoursmtpserver"; try { //MailMessage represents the e-mail being sent using (MailMessage message = new MailMessage(from...

Find If Assembly Compiled in Debug Or Release Mode

1. Locate and run ildasm.exe application on your mashine 2. From the top menu select Open-> View-> MetaInfo-> Show! 3. Find following text "System.Diagnostics.DebuggableAttribute". You should see something like CustomAttribute Type: 0a00000d CustomAttributeName: System.Diagnostics.DebuggableAttribute :: instance void .ctor(value class DebuggingModes) Length: 8 Value : 01 00 07 01 00 00 00 00 > ctor args: ( ) 4. Value of this attribute for Release Version the value should be Value : 01 00 07 01 00 00 00 00 and for Debug Version it will look like Value : 01 00 02 00 00 00 00 00

Unable to Start Debugging on the Web Server

Check that IIS is running. Make sure that IIS is configured to use Integrated Windows Authentication . Look for the checkbox on the Authentication Method dialog launched from the Directory Security tab of the site properties. Make sure that HTTP Keep Alives are enabled. You'll find that checkbox on the Web Site tab of the properties dialog, in the connections section. Add http://localhost to the trusted sites in Internet Explorer. To tell the truth, this seems to be a fix for the symtoms, not actually fixing the problem itself, but if it works it works. BTW, you'll have to uncheck the “Require server verification (https:) for all sites in this zone“ checkbox to add it as a trusted site.