Rahul Soni's blog

Never assume the obvious is true!

Browse by Tags

Tagged Content List
  • Blog Post: Run a batch file as a specific User (or Administrator) from ASP.NET...

    ...well first of all, I am NOT recommending it, but sometimes it could be necessary! Now, let's proceed to the code... 1. Create a page called RunBatchFile.vb and paste the following... Imports System.Diagnostics Imports System.IO Partial Class RunBatchFile Inherits System.Web.UI.Page Dim _password...
  • Blog Post: A sample to help in other samples related DataSource

    There are quite a few times, when I get an issue related with a specific DataControl and I want to bind it to a datasource. All geared up and with full enthusiasm, I start dealing with the issue... and DARN... I find that I did something awfully bad with my SQL Server during my last case!! So now, instead...
  • Blog Post: Dim browser As SHDocVw.InternetExplorer does something different in Vista

    First of all, I wouldn't pretend to know something which I don't. But this is kindda interesting... I got a comment on one of my previous posts from Boyd who was seeing a weird error on Vista. He had an application with the following code... Sub test() Dim br As SHDocVw.InternetExplorer br = New SHDocVw...
  • Blog Post: Enable wrap and change the color of Listbox items

    Problem description> You have a Listbox where you have a lot of items which are quite large and won't fit inside the width of your listbox. You don't want to enable Horizontal Scroll bar, since you have don't want your users to keep scrolling left and right in order to view the items. Now if you are...
  • Blog Post: Change the border color and style of PictureBox in VB.NET

    You know that by default you don't have too many options to change the Border Color/Style of a normal PictureBox control. I wanted to customize this control a little bit, so that you can at least change the border color and style when you click on any image. Let's see how it looks, and then I will show...
  • Blog Post: Read or Write Resources from/into a DLL in .NET 2.0

    I created a Windows Live Writer plug-in for inserting Smileys a while ago. It depends on a TXT file which was initially present under Application Folder + "\Plugin" folder. Recently, due to design changes in the beta version of WLW, the plug-in started crashing due to the missing Text file! So the question...
  • Blog Post: Sample page in ASP.NET to show you different collections like Forms, Querystring, Cookies etc

    Sometimes, while troubleshooting I am interested to find out all the details about certain collections in ASP.NET, like Forms, QueryStrings, Headers, ServerVariables, Cookies, Sessions and Params... I created a very simple aspx page which would show you all the details... Create any text file with .aspx...
  • Blog Post: Create Windows Live Writer plugin using Visual Basic.NET

    Windows Live Writer is cool! I use it to create my blog posts and of late, I wanted to make my blog a little more colorful. I was looking for the plugin which could do what I want (just too many things in life!) but couldn't find it. That's why, I decided to write a plugin for myself. I guess that's...
  • Blog Post: Using Forms Based Authentication in ASP.NET for Static Content (Doc Files, PDF Files etc.)

    Scenario: You want to implement Forms based authentication for ASP.NET web application, and you have certain document/PDF files which need to be protected. It should be such that even if you try to browse that .doc file directly, it should take you to the Login Prompt OR it should simply deny access...
  • Blog Post: How to get the Folder Size in VB.NET

    My problem was not really big, but it was a problem which really irritated me a lot!! We store data based on the user's alias in a folder called D:\SomeFolder on remote machine. In due course of time though, the hard disk starts giving No Disk Space problems, and we need to ask the users to delete...
  • Blog Post: Using System.Management to get information about the Operating System from your VB.NET Application

    I blogged about how to find Operating System Information from your VB.NET 2005 application last year in March. I found that Nilesh has posted a very nice reply to that post to ensure that the output of that program is even better. Initially, if you used my code listing, you would have seen an output...
  • Blog Post: A sample aspx page to show the security details

    This is a pretty small sample to help you figure out the ASP.NET identity matrix and how it comes in effect. I am posting this since quite often we need to troubleshoot security related issues on a production website and making any Application level changes become really difficult. What you can do...
  • Blog Post: Customize errors which are not captured by customErrors in ASP.NET 2.0

    Yesterday, I came up with an interesting issue where a customer wanted to customize a 500 error message ("Internal Server Error"). Interestingly, customErrors DID NOT seem to work for StatusCode 500! We just wanted to verify if it works for 404, and it did... < customErrors defaultRedirect = "...
  • Blog Post: Compare file versions and other important details on two different boxes

    Quite often, we hear that two boxes are completely alike but for some reason a program that works on first just fails on another. Sometimes, you suspect certain patches which got applied on one box and not applied on the other box might have been the issue. The question is... how do you find out which...
  • Blog Post: How to read User and System Variables using VBScript

    Quite easy! Dim objWSH Dim objUserVariables Dim objSystemVariables Set objWSH = CreateObject("WScript.Shell") 'This actually returns all the User Variables, and you either loop through all, or simply print what you want Set objUserVariables = objWSH.Environment("USER") MsgBox(objUserVariables(...
  • Blog Post: Visual Basic and IE 7, open pages in new Tab or Window or wait for the page to be displayed completely

    I was working on a project where I had the following requirement, and for a moment I thought, "Man, that's like a 5 min task for me!!". And it should have been!!!! Unfortunately though, I couldn't find the right document at the right time and it took me some time to achive what I wanted to achieve :...
  • Blog Post: Open EXCEL file with VB6 and read the content

    I was planning to write an application today which simply opens an Excel file and read the Cell values into an array so that I could manipulate it accordingly. Since I don't have VS.NET installed on my home PC, I decided to do it with VB6 :o) Here is the code... Private Sub cmdOpenExcel_Click(...
  • Blog Post: String Concatenation vs String Builder - The performance hit! See it to believe it :o)

    In this post, I am going to discuss about using String Concatenation vs String Builder . I have created a very simple page which creates a string using three different methods. 1) Writes directly to the Response Cache 2) Creates a String variable using String concatenation 3) Creates a String variable...
  • Blog Post: Run a command from the command prompt and get its output in a Windows Application

    In this pick, I wanted to show you how to execute commands on the command prompt and get its output in a regular Windows Application . The command in the following code will be entered via a VB.NET Windows application and we will get the output in a Textbox called txtOutput . The command I have used...
  • Blog Post: Unable to change the DisplayMode of a WebPartManager

    I had an issue where I was changing a WebPartManger's displaymode using the following code... WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode or WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode I didn't use SQL Express for my database. Instead I was using my Web.config...
  • Blog Post: How to use SQL Server in ASP.NET 2.0, if you don't have SQL Express for VS 2005

    I don't have the SQL Express on my box and I still want to use database for my ASP.NET 2.0 application. Here is what I do to configure each of my application to use the MS SQL 2000. 1) Go to the the Visual Studio 2005 command prompt OR a regular command prompt and navigate to C:\< WINDOWS >...
  • Blog Post: Load XML file data in a Treeview control in Visual Basic 2005

    We have an XML file that needs to be loaded in the TreeView control. This entry shows How do we do it in VB.NET 2005. Let's create a VB.NET Project. Drag and drop a TreeViewControl and name it tvwMetabase . Also drag a Button control and name it btnLoad . Modify the path of the following code to point...
  • Blog Post: Find Operating System Information from your VB.NET 2005 application

    In VS 2005, it has become really easy to find the Operating System's information using some of the classes. Let's take a look at how do we do it in VB 2005... Sub DisplayOperatingSystemInformation() Dim osInfo As OperatingSystem osInfo = Environment.OSVersion Dim verInfo As Version verInfo = osInfo...
  • Blog Post: 4 ways to send a PDF file to the IE Client in ASP.NET 2.0

    In this pick, I am sharing a project using which you can send PDF files to the IE Client in four different ways. You may download the project by clicking here . Create a new C# Website. While creating the following pages ensure that you DON'T have "Place code in Seperate file" checkbox as checked...
  • Blog Post: Dynamically adding webparts to the dynamically added Catalog zone

    Today we are going to discuss how to add webparts to a Catalog Zone dynamically in your webpage. Sometimes, you may have quite a lot of different webparts which you don't want to add by default to any page. Instead, you want to design an interface where you have added everything into your catalog...
Page 1 of 2 (36 items) 12