We were stuck with a weird issue. Our ASP.NET web app was crashing for some reason and the event log only displayed Stackoverflow exception. We want to narrow down the reason for the crash and since stackoverflow exceptions are easy to debug (even crash dumps didnt give help much), we wanted our app to shut down the moment first time this excepton occured. Application pool recycles itsel...
The default SqlCommand timeout is 30 seconds, so you might get this error while executing a lengthy Sql operation (like creating a DB and its schema via C# code): Error : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. In order to fix this, just increase the command time out as follows: myCommand.CommandTimeout = 120; // 2...
We had created a Visual Studio project in C# to create SQL Server 2005 database via C# code. We were referencing these assemblies: Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.ConnectionInfo.dll We also added this DLL but did not reference it as we realized it was required internally by the above assemblies: Microsoft.SqlServer.SqlClrProvider...
If you have installed ASP.NET 4.0 runtime on your system before installing IIS, you may run into this error while trying to run your ASP.NET web projects locally configured in IIS: HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. To fi...
One of our developers got this error while locally configuring ASP.NET 4.0 website on his local IIS 7 server: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default. (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false" To fix t...
Today I got this weird error in one of our projects in Visual Studio while getting latest from my Git repository: Files has invalid values The solution would give this error on "clean" or rebuild. After some Google searches, I found a fix to this error: simply delete the "obj" folder for the errant project. I did this and did a Clean and rebuild, and it worked fine this time. Hope this q...
Sometimes using Visual Studio Git Extensions , while switching in and out of Git branches, you may encounter this error: error: bad index file sha1 signature fatal: index file corrupt Your Git index may get corrupted, and here is a quick fix to restore your index to your last commit: 1. Open Git bash by going to Start-> All Programs-> Git-> Git Bash. This will open up the Git ba...
I was compiling one of my friend's project and noticed this error: Friend assembly reference is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations. This error came up because one of the projects in my solution had a friend assembly reference to the other, and I needed strong signed assemblies for this project. To fix this error: 1. G...
I want to let you know about a great opportunity that enables you to improve your skills and learn about the latest developments in the IT industry. PacktLib, Packt’s online digital library, is now free for Indian residents, professionals and students outside of office hours. Between 8pm and 8am during weekdays and throughout the weekends, PacktPub account holders will have unrestr...
Boot from Windows 7 VHD file If you have an exisiting Windows installation, and want to install a fresh one from a VHD file, you can easily do that using "bcdedit' tool in Windows 7. Lets say you have a Windows 7 VHD file located in your "D:" drive at this location: D:\Windows7.vhd. Now you need to add this VHD in your Windows boot load menu. Follow these steps: 1. Open DOS command promp...
Programming standards in India: Hard to find talent We are trying to hire a few high quality developers for our India office and are having a hard time finding skilled developers . I feel sad to see so many so-called "developers" responding to our job posts, but in reality most of them do not even know the basic foundations of software development. We have strict quality improvement guid...
XBox 360 vs Sony PlayStation 3: Which one should you buy? Having hands-on gaming experience on both Microsoft XBox 360 and Sony PlayStation 3, I would recommend PlayStation 3 for new buyers. Why? Here are my arguments: 1. HDD Space issue: XBox 360 will NOT let you use any external USB hard drive with more than 16 GB space. For example, if you want to add more space to save games/demos et...
I think there is a bug in VS 2008 (Professional Edition). I installed it on another new machine and this time I did not install Visual Web Developer (as it was not required at all). Everything went fine with the installation and after rebooting the machine, I got the shock of my life: I could not create a Website!! The menu was simply not there under File option! I tried using devenv /re...
Since many people would agree with me that Windows Vista has a lot of problems for developers, the only option is to revert back to Windows XP Pro on all these new pre-installed Vista laptops. But 90% of the time, upgrading poses this stumper: Setup did not find any hard disk drives installed in your computer To fix this issue, we need to change the SATA/ RAID mode one and disable cachin...
Recently I faced a strange issue: while working on a sample project in ASP.NET 2.0 and VS 2005(which just had one form loading records from a single table from a SQL Server 2005 DB), I face this error as soon as I form started loading in the browser: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the ...
Step-by-step Guide on using Github with Visual Studio Source control is an integral part of software development, and a good source control tool not only increases developer productivity but also helps in managing your software development cycle more effectively. Throughout last 10 years I have used a variety of source control tools, from the "un-scalable" VSS (Visual Source Safe) to Sou...
In a recent project, we had to create strong named version of two assemblies (A and B, where A refers B) without recompiling. Using the method mentioned here: http://blogs.msdn.com/b/miah/archive/2008/02/28/how-to-assign-a-strong-name-to-an-unsigned-3rd-party-assembly.aspx we were able to create the strong named versions of both A and B. But when we added these assemblies in the client p...
While serializing your WCF data items, we have two options: 1. Use the [DataContract] attribute : new attribute available in WCF (.NET 3.0 or above). Used with [DataMember] and [DataContractSerializer] 2. Use the [Serializable] attribute: older attribute, required when using the BinaryFormatter class. Usages and differences Though both attributes can be used together, the [Serializable] ...
Assume you have a text file, and you want to read all its contents into a C# string variable. Here is a quick and easy way to do it in just one line of code: string text = System.IO.File.ReadAllText("{{path to your text file goes here}}");
One of our trainee programmers had written this query in SQL Server: --UPDATE SORT ORDER TO 1 + (the current max value) UPDATE [My_Question] SET SortOrder = MAX(SortOrder) + 1 WHERE QuestionID = @QuestionID He wanted to set the Sort Order of this question to the next integer value by checking the maximum value in the list of questions already added. While trying to run this he got this e...
One of our programmer friends asked this query recently: I want to send an email to my site user once he clicks a button. This email will contain a link with the userID of a user in the link URL (as query param of a link). Once the user clicks this email link, my server side code will parse and decrypt the userID query string key to get the user ID and perform some action on it. I cannot...
The Facebook API: Why it sucks? Thousands of developers are using the FB API not only for the different kind of applications developed for the Facebook platform, but also for simple things like Facebook Connect. We have been working on the API ourselves, and unfortunately reached the conclusion that its one of those badly written, poorly maintained APIs, with absolutely no thought given ...
Difference between HttpModule and HttpHandler in .NET This is quite a popular question in most .NET interviews, and all beginner .NET developers should be able to answer it. In this quick blog post I will try to simply the difference between these two pillars of ASP.NET programming model. To start with, it is very important to understand that all ASP.NET requests are handled by a web ser...
Difference between const and static readonly keywords C# If in your C# class you want to use a variable whose value will not change during the lifetime of that class, then you have two options: 1. Use the "const" keyword: for e.g. public const int myVar = 100; 2. Use the "static readonly" keyword: for e.g. public static readonly int myVar = ConfigurationManager.AppSettings["value"]; The ...
Difference between a dedicated server, shared server, VPS and cloud hosting? Before the advent of the buzz-word "cloud", there were primarily 3 major hosting options for your web applications: 1. Shared Server : You share the server space and hardware (RAM, Disk size, CPU etc) with others on a single server. The server admin will allocate you a fixed hard disk space (database may be incl...
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address:
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18