asp.net tab index

Leave a comment

here’s a quick one. I created a web page with 2 textboxes, called them textbox1 and textbox2. The problem was that when i tabbed from the first one to the second one it would jump somewhere else on the page. I’ve created pages in the past, but it always just worked correctly in all browsers. It could have been because I added textbox2 after, but I’ve inserted controls in between 2 controls and the tab index has worked automatically. I went about and set the tabindex property of the control to 0 and 1 respectively. It still didn’t work. So after getting frustrated i tried setting them to 1 and 2 (instead of 0 and 1) and it worked perfectly. Hope this helps someone out.

Advertisements

Multiple Desktops On Windows

Leave a comment

Not sure how long this has been out, but I just came across a helpful tool. Those of you who use Ubuntu or most other Linux versions are familiar with multiple desktops. I was using the sysinternals suite to troubleshoot a file problem i was having, and I came across Desktops application that allows you to do this. It is ridiculously easy to use and you can set it to load on startup. You can also easily switch between screens with shortcut keys just like Linux.   It also has some limitations, such as you can’t close windows once they are created (need to logoff to close).  For more info or to download you can visit here or just get it as part of the sysinternals suite which contains great tools for troubleshooting and maintenance.

Windows 2003 Server WPAD AutoConfiguration Including Subnets

1 Comment

Recently I decided to push autoconfiguration proxy settings out to my clients via WPAD. The reason I did this is that I used to push them out via Active Directory Group Policy, however I have some computers on my network that are not part of a domain, and I wanted to be able to enforce our company’s web and security policies to them.  This was not extremely difficult, however, one problem that I ran into was that it would not work on subnets other than the one that my proxy was located on.  Here’ s how I was able to implement this and push it out to subnets:

First off I am using GFI WebMonitor 2010 for my web proxy. I like this product because it includes its own proxy server so I did not have to purchase ISA server in order to run this on. I use a hardware router so purchasing ISA just to run a web proxy seemed to be a waste of money.

To start off, this software makes it pretty easy to publish your WPAD to the network for computers to access. In GFI WebMonitor I just did the following:

This automatically creates your wpad.dat file and publishes it.

You can view the wpad.dat by going to http://wpad/wpad.dat  The wpad.dat has a lot of configuration info in it, but the gist of it is this:
function GetStandardProxy(url, host) { if(host == “127.0.0.1”) { return “DIRECT”; } else { return “PROXY 192.168.1.12:8080; DIRECT”; } }

Then I needed to create the entries in DHCP and DNS to point to the WPAD so browsers could find and use the proxy server. The main problem I ran into is that computers on the local network where the proxy is located picked this up automatically and gradually started redirecting to my proxy server, but computers on my other subnets would not pick this up. I assume that the router was blocking some sort of broadcast, so I decided to put the entries in both DHCP and DNS to circumnavigate this as there is a router or 2 that is controlled by another consultant.

In DHCP this is pretty easy to do although you need to add option 252. In DHCP, right-click on your server and click on “Set Predefined Options”, Click “Add”, for the code enter “252”, for the name enter “wpad” and for the “data type” enter “String”  Why its not there by default is baffling, but it’s easy enough to add.

Now for the DNS entry. Under Forward Lookup Zones, Enter a new alias (CNAME), call it wpad, and then point it the server that houses your wpad file.  This should replicate to your other DNS server.  For testing purposes just make sure that you do it on the first server listed when performing an IPCONFIG /all.

Now here’s the part that had me stumped for a while. I go to http://wpad/wpad.dat on a computer located on another subnet and you get a 404 page.  After doing some research I found out that microsoft blacklists this entry in DNS by default (?). The way to unblock it is to edit the following registry entry. At HKLM\System\CurrentControlSet\Services\DNS\Parameters open up “GlobalQueryBlockList” and delete the entry that says “wpad”. Then restart your DNS server.  Now go back to one of the computers on that subnet and then you should get the wpad.dat script.  (MS reference KB: http://support.microsoft.com/kb/2003485 )

There’s one more thing to do.  Go to your DHCP server, right-click and go to Scope Options, and select “252”, then enter your string value.  Mine is http://myserver/wpad.dat . Something to note on this address is that I read that it may be case-sensitive so just enter it lowercase to save you the headache.

That should be it. Here’s some reference and troubleshooting articles as well as some other sources where I pieced together all of the information from.

MS Lowercase Only
http://support.microsoft.com/kb/307502
Explanation of Blacklist
http://clintboessen.blogspot.com/2010/08/unable-to-resolve-wpad.html
MS Troubleshooting Automatic Connections
http://technet.microsoft.com/en-us/library/cc302643.aspx

Security info about WPAD and Man In the Middle Attacks.
http://perimetergrid.com/wp/2008/01/11/wpad-internet-explorers-worst-feature/

Philly loses woohoo!

Leave a comment

I hate when my NFL season comes down to mostly rooting for teams i despise to lose, but that Philly loss was the best thing for a Giant fan this year. For Vick to choke on the last play of the game made it even sweeter.  I heard all the dogs in my neighborhood howl as the Dog Executioner lost big time.  Eagles looked like they could be Superbowl contenders this year now they will enjoy a few rounds on the golf course.  Justice has been served.  They still hold bragging rights for that game a few weeks ago against the Giants. no doubt, but in the scheme of things it really didn’t amount to a hill of beans since they couldn’t even get past the wildcard round.  see you next year eagles.

Deploying An Asp.Net Site To Network Solutions With Membership

13 Comments

Tools Used:

Visual Studio 2008 Professional Edition

SQL Server Management Studio

Recently I was developing an ASP.NET site which worked fine on my computer, but when I went to deploy it to Network Solutions, it did not work, and their Support was not very helpful.  They told me  that membership could not be used. They also told me that asp.net, while supported, could not be used on the server since it is shared hosting environment.  Further they told me that they could not create an “Application” like I would using IIS also because it is a shared hosting environment.  They also do not have an option (in windows) for VPS that would allow full control.  All the stuff they told me  is basically not true or only partially true.

First off in order to get your asp.net site up and running (without membership) all you have to do is copy your aspx files to the root of the htdocs folder that they supply for you.  This in itself is an application directory and because of this you can run ASP.NET pages.

Second, you can use membership by going to their admin pages, creating a database, exporting your data and schema from your current membership database, and then running a script in query analyzer. Here’s how you do this:

1.       To start off you should have a site with membership that allows you to login successfully from your local computer. There are plenty of tutorials online that will help you out with this but it’s beyond the scope of this post.

2.       Now we create the sql database on Network Solutions.  Go to Manage Account>>My Hosting Packages>>Click on Web Hosting Toolkit>>Go down to the bottom of the page and click Database Manager >>Click Microsoft SQL Server (Note: if nothing pops up and you get “sessionId=0”, logout using the link on the top right hand side of the page.)

3.       Click Add to add a new DB . Then enter your information for the new database.  Just make a note of what you entered here:

4.       Now that we have a DB, lets connect to it using SQL Server Management Studio.  Network Solutions gives you the address to which to connect to after you create the database.  When you are in database manager , select your newly created database and then click edit to view it. Open SQL Server Management Studio and enter the ip address, your username and password to connect.

5.       Now that you are connected, minimize SQL Management Studio, and then open up your website in Visual Studio. We will now we will create the .SQL script to recreate the schema and data on the network solutions database we created above.

6.        In Server Explorer, Right Click on aspnetdb.mdf and click “Publish To Provider”, then follow the wizard. This will create a sql script replicating the aspnetdb.mdf database. here’s what my screen looked like.

7.       Now that you have the sql script created, open it using your favorite text editor, and then copy all of it’s contents.

8.       Go back to SQL Management Studio, Find your database name under databases and (you can see all network solutions databases hosted on that shared server), single click it and then click “New Query”.  This will open up a sql window.

9.       Paste all the code that you copied in step 7, and execute the script.  This should recreate all your user information, roles, security, etc.  I did not have any errors when doing this so I can’t really help you out if it doesn’t work.

10.   Next modify your web.config file to include a new connection string to point to this new database. Here’s the string that I used in my web.config file.


<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=IPAddress;Initial Catalog=URDBName;User Id=URUsername;Password=***********;" providerName="System.Data.SqlClient" />
</connectionStrings>

11.   Next ftp all of your files up to Network Solutions server using the Manage Account>>FTP/ContentPublishing  provided by them.  I use filezilla, it’s easier.  I uploaded them to the root of the htdocs folder, and voila everything worked.

Another note, Network Solutions support was telling me that If I have an access database (which I do), I need create a new folder called “db” under the HTDocs folder and adjust my code to point to this folder.  They said this is due to permissions. This worked flawlessly.

Another note: If you use smtp in your asp.net, create your email address in network solutions Manage Account, and then add the following information to your web.config file:

<system.net>
<mailSettings>
<smtp from="myemailaddress@mydomain.com">
<network
host="localhost"
port="25"
userName="myemailaddress@mydomain.com"
password="*********" />
</smtp>
</mailSettings>
</system.net>

I would also like to give credit to this site for information on the Visual Studio schema export.