Loading ...

  • Today we faced a weird issue. We noticed that on one machine images were not displaying in browser. On taking screenshot of same window the images appeared in the screenshot. After checking the Firebug inspector it was also cleared that images were ate the correct locatoion? So what was the issue? It turns out that the Contrast of the screen was to
    Raghav Khunger  · 12/30/2013  · 0  · 1502
     /5
    Avg: 0 / 5 (0votes)
  • While using Directory.GetFiles I started getting the following excpetion Path too long error message when exceeding MAX_PATH Luckily I came across the following library: Delimon.Win32.I​O Library (V4.0) http://gallery.technet.microsoft.com/DelimonWin32IO-Library-V40-7ff6b16c This Library is written specifically to overcome the limitation of the .NE
    Raghav Khunger  · 12/27/2013  · 0  · 1595
    c#
     /5
    Avg: 0 / 5 (0votes)
  • File.Move: Access to the path is denied
    While using the File.Move method to move a file from one location to other: File.Move(oldPath, newPath); I was getting the following exception: Access to the path is denied. Exception Details: System.UnauthorizedAccessException: Access to the path is denied. The fix for this was to give IIS_USRS account full control permissions: After giving the pe
    Raghav Khunger  · 12/27/2013  · 0  · 3284
    asp.net c# file-move
     /5
    Avg: 0 / 5 (0votes)
  • Removing "X-Powered-By" HTTP Header in ASP.NET
    When IIS sends the response to browser it also sends "X-Powered-By" HTTP Headers along with the response. It can pose security risk to your server. It can be removed via adding following code in the system.webserver section of web.config file of your application: <httpProtocol> <customHeaders> <remove na
    Raghav Khunger  · 12/27/2013  · 0  · 3917
    iis-7
     /5
    Avg: 0 / 5 (0votes)
  • Removing "Server" "X-AspNet-Version" HTTP Headers in ASP.NET
    Whenever a browser makes an HTTP request to a web server, the webserver sends the response along several HTTP headers. SOme of them are necessary and tehre are few others like "Server" "X-AspNet-Version" which can be removed as they can pose a security risk. Here is the screenshot of Response Header for a nomal request to IIS se
    Raghav Khunger  · 12/27/2013  · 0  · 1429
    iis-7
     /5
    Avg: 0 / 5 (0votes)
  • Increase the font size of Firebug
    If you are struggling with the small font size Firebug don't worry it has solution. It is configurable. This can be done via clicking firebug icon and then selecting the menu as shown in image:
    Raghav Khunger  · 12/25/2013  · 0  · 1207
    firebug
     /5
    Avg: 0 / 5 (0votes)
  • There are situations when you have very large .sql files and you want to execute them. The issue comes when you have to open those files in SSMS. They start giving out of memory exceptions. The solution is to use sqlcmd utility to run the same. You can execute them like below: sqlcmd -S localhost -d master -i "C:\Software\script.sql" -a 3
    Raghav Khunger  · 12/22/2013  · 0  · 1204
    sqlcmd
     /5
    Avg: 0 / 5 (0votes)
  • Generate SQL Server 2008 R2 compatible script from SQL Server 2012
    If you have SQL Server 2012 and want to create Schema and data script for SQL Server 2008 R2 you can follow the following steps: Right click the DB. Select "Generate Scripts" Go to Set Scription options and click "Advance options" and then select "SQL Server 2008 R2" value for "Script for Server Version" opti
    Raghav Khunger  · 12/21/2013  · 0  · 1025
    sql-server-2008-r2 sql-server-2012
     /5
    Avg: 0 / 5 (0votes)
  • If you are using SQL Server Management Objects (SMO) and want to take backup of a database the following code will help you: private static void BackupDatabase(string dbName, string backupPath) { // Fetch the server name from web.config connection string. string serverName = new SqlConnection(SQLHelper.GetConnectionString()).DataSource; // Create t
    Raghav Khunger  · 12/15/2013  · 0  · 1663
     /5
    Avg: 0 / 5 (0votes)
  • You all might be familiar with Assembly.LoadFrom method which can be use to get the version of the assembly but this method has a disadvantage as it will load the assembly into the domain and you will not be able to update that assembly after loading the assembly until the current app domain is unloaded. The solution is to use AssemblyName.GetAssem
    Raghav Khunger  · 12/15/2013  · 0  · 1262
    reflection
     /5
    Avg: 0 / 5 (0votes)
  • IIS: Cannot start service W3SVC on computer '.'
    On starting IIS on my machine I was getting Cannot start service W3SVC on computer '.' message: The solution was to run the following command via command prompt: net start w3svc After running the above command I was able to start the IIS
    Raghav Khunger  · 12/15/2013  · 0  · 2454
    iis7
     /5
    Avg: 0 / 5 (0votes)
  • I was creating sql backup via an ASP.NET application. On running the code written for creating backup I was getting the following exception: Backup Failed for Server 'xxxxx' Operating system error 5: Access is denied The error represents that we do not have permission to create backup at desired destination. But the question was to which ac
    Raghav Khunger  · 12/15/2013  · 0  · 1703
    sql-server-backup
     /5
    Avg: 0 / 5 (0votes)
  • I was working with a project using SQL Server SMO to connect/communicate with SQL server. For that I needed SQL Server SMO dlls. After struggling a bit I was able to locate it and the path for those dlls is: C:\Program Files\Microsoft SQL Server\110\SDK\Assemblies Below is the screenshot for it:
    Raghav Khunger  · 12/15/2013  · 0  · 1282
    sql-server-smo
     /5
    Avg: 0 / 5 (0votes)
  • Error: Cannot read configuration file due to insufficient permissions
    While reading a config file which was present in other website from an application I was getting: Error: Cannot read configuration file due to insufficient permissions The reason for this issue was that the App Pool identity of the application from which I was trying to read the config file was "Network Service: The solution was to change the
    Raghav Khunger  · 12/15/2013  · 0  · 1933
    iis-7 iis-7.5
     /5
    Avg: 0 / 5 (0votes)
  • There is different logic to detect IE11 in C#. It can be done via: Regex.IsMatch(current.Request.UserAgent, @"Trident/7.*rv:11") So over all IE detection can be done via: public static bool IsIE() { HttpContext current = HttpContext.Current; return current.Request.Browser.Browser == "IE" || Regex.IsMatch(current.Request.UserAgen
    Raghav Khunger  · 12/12/2013  · 0  · 5363
    ie internet-explorer-11
     /5
    Avg: 0 / 5 (0votes)
  • This can be achieve like this: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> if (!window.jQuery) { document.write('<script src="/path/to/your/jquery"><\/script>'); } </script>
    Raghav Khunger  · 12/12/2013  · 0  · 1046
     /5
    Avg: 0 / 5 (0votes)
  • Install PHP 5.5.6 on Windows Server 2008 R2 Installing PHP on IIS 7 with Windows server 2008 can be tricky as the instructions mentioned in many official documents do not work with PHP 5.5.6. Here are the steps to install PHP 5.5.6 on Windows 2008 R2: 1. Download latest version of PHP from here: http://windows.php.net/download/ Make sure you downlo
    Vivek Thakur  · 12/12/2013  · 0  · 4425
     /5
    Avg: 0 / 5 (0votes)
  • Using JavaScript file hosted on github: Refused to execute script from 'xxx' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
    For sample purpose I was using the js references directly from Github i.e I was using this: <script type="text/javascript" src="https://raw.github.com/WickyNilliams/headroom.js/master/src/jQuery.headroom.js"></script> <script type="text/javascript"> And after running the page h
    Raghav Khunger  · 12/12/2013  · 0  · 3051
    github
     /5
    Avg: 0 / 5 (0votes)
  • How to use Headroom.js
    Headroom.js is a lightweight, high-performance JS widget (with no dependencies!) that allows you to react to the user's scroll. The header on this site is a living example, it slides out of view when scrolling down and slides back in when scrolling up. Below is the js fiddle how to use it: http://jsfiddle.net/raghav_khunger/d7QQ8/2/ You just ne
    Raghav Khunger  · 12/12/2013  · 0  · 20149
    jquery headroom.js
     /5
    Avg: 0 / 5 (0votes)
  • If you want to get first and last date of month based on input date following code will help you: public static DateTime FirstDayOfMonth(DateTime dateTime) { return new DateTime(dateTime.Year, dateTime.Month, 1); } public static DateTime LastDayOfMonth(DateTime dateTime) { var firstDayOfTheMonth = new DateTime(dateTime.Year, dateTime.Month, 1); ret
    Raghav Khunger  · 12/5/2013  · 0  · 1644
     /5
    Avg: 0 / 5 (0votes)
  • Page 1 of 1 (20 items)

Filter blogs

Top Producers

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?