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 As New System.Security.SecureString Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)…

3

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…

1

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…

1

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…

12

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…

6

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 here is,…

3

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 extension in your IIS (I have named it Collection.aspx)…

5

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…

3

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 to the file. In a…

8

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…

5