Monthly Archives: January 2004

IIS6 and Visual Studio/Interdev 6

Oh no. Here we go again. My client asked me to make a minor change in their old website which I did in InterDev. I never updated it to asp.net since it is a rarity to make a change.

I couldn’t open up my project in VI6 because I don’t have the FrontPage98 server extensions on the new box.

After googling for a quick fix (for over a quick 90 minutes) I just finally went into notepad on the live machine and modified the damned file (late at night – not a problem).

 

BCL … Literally

When I started working on my Edge East presentation (that I have written about a lot lately) I was really focusing on the fundamentals of the BCL. The conference organizers had picked the same title as Kit George’s talk at PDC which was absolutely about the fundamentals. But the more bounced some questions around the more I realized that because the literal definition of the Base Class Libraries is ALL of the classes, that this is what most people also tend to lean towards.

So I really struggled with trying to decide if I should aim “high” – for those people who might be expecting a wide variety of things from the classes including System.Windows or System.Data (lots of interesting new things in system.data!) – or aim low at those who are in fact looking for the fundamentals.

I am not duplicating Kit’s presentation. Even if I wanted to it would be impossible since he used different bits (and knows this stuff a little better, heh)!

I rewrote my abstract 4 times. But as I wrote earlier, I eventually decided where I wanted to be and finally got going on it.

Though 80% of my choices are still from the fundamentals, I currently do have in there some of the new System.Data classes/methods as well as a mention of a property that falls into the windows name space.

Kit George has been kind enough to talk with me about this and I am again inspired to stay low and focus on those classes that do fit in to the Fundamentals area that I look at every day on my beautiful WinFX poster.

The real problem goes back to here – so many new great and interesting things and only an hour or so to talk about them.

All of this angst for an hour long talk. But really it’s fun because I am learning a lot of things that I might not have taken the time to focus on right now. And it is only going to make the presentation that much better.

orkut again

Okay so now I am getting something like spam in orkut. You can send an email blast to all of your friends (I have like 10) or to the whole network of friends of friends of freinds… mine says 12,858. So I can’t say the messages I’m getting are coming from 10th generation friends or anything – in fact they are only one away, so each of these is from someone who is a direct friend of someone who is my own personal direct friend. I just don’t know… I will keep looking at it. I am not inviting anybody else in. I only invited 2 people who weren’t already in and one of them really is anti-orkut! Don’t take it personally. It doesn’t make sense for me to do that when I don’t quite believe in whatever it is yet.

I do have to say that I did get this apology in a message though:

“I shoulda done the math on friend of friends before pushing the button. yeeeeagh! “

So, maybe also a lot of this is just that people have to figure out how to use it and what they want to do with it…

My non-admin account

I thought I had beat the most famous non-admin problem of running quickbooks by using the “run as” option. My days as a non-admin user were almost becoming a full week of success until I tried to revisit a VB6 project and compile it. Throw on the breaks. System Registry access problems. I logged out and back in as admin and gave myself full perms on the hkey_local machine section. Back to my own login – still no compilation. Log out. Log back in as admin, well it’s trying to register these classes so it needs access to HKEY_CLASSES_ROOT. I really don’t wanna do it, because anything that invades my computer in an email will now have access but – what’s a girl to do. Full perms on the classes_root, chug chug while it goes through all gazillion of the. Log out, log back in as me the non-admin, pretty background screen and then….nothing. Nothing nothing. I can get to task manager, get to the dos prompt from there, etc. but I cannot run explorer. Hmmm says I. Back to admin login, everything *looks* okay in documents and settings. Fiddle around for a few hours. Try to do a safe mode login – same thing basic effect with out the pretty picture, but I get all the “safe mode” bits in the 4 corners.

I create a new local login and login as that. Same.

Create a new domain login and login as that. Same.

I go back to admin and gulp – make myself an admin and all is well again. except now I’m back to being a non-admin and feel very exposed and wasted many hours today. Oh well.

Orkut madness

Halley, I totally hear ya! I just don’t GET it. Yeah, I got invited, and checked it out and invited you too, but that was about a week ago and now I am really wondering what the point is. I *have* a network. In fact, sometimes I think I am overnetworked. I don’t know what Orkut adds to the mix. Except flattery. I was flattered by some of the invites I had. But [wo]man cannot live on ego alone!

ASP.NET, IIS6, NETWORK SERVICE and SQL Server

Hooo whee did I have fun yesterday and once again learned a lot about something that was low on my list of things to learn! This is about solving the problem of the default IIS6 security account not having access to SQL Server and some lessons in managing that security account.

I have a new Win2003 Server with IIS6 set up. I’m not sure in Windows creates this account or IIS6 does, but IIS6 defaults to using the account “NT Authority/Network Service“ as it’s main security account. You can actually change this if you want. In the Application Pool you see in IIS, you have an option to change the identity of the main security account for IIS. There are 3 defaults or you can select your own account.

I have a domain controller. In Win2000 Server, I had to use the IWAM_Server as my main security account. That means I had to give this account NTFS permissions on my web folders and also in SQL Server. I don’t know if there was a way to change the account in IIS5, but if there was, it was elusive. In fact, I had to deal with this when I made some changes to my Win2000 Server and suddenly couldn’t debug ASP.NET, etc. It’s because I now had to give taht IWAM account access to everything. In fact, here is the post where I learned that lesson – the real lesson was thanks to a comment by Mark Pearce.

On to Windows2003 and IIS6. I was able to debug, but my asp.net apps now didn’t have access to SQL Server.

Googling, I saw that I could via TSQL, just add the Network Service account to SQL Server. Through Enterprise Manager, that account is not exposed, but you can do it through TSQL (and then see it in Ent. Mgr). But I didn’t do it correctly the first time. I added it to a user database (Users), and not to the “master” database, which is the same as adding it to Security/Logins. So thinking that it just hadn’t worked, I looked a little harder which is where I got my big lesson. What I did not want to do (even though this is just my development environment and used only by me) was just switch over to mixed authentication. I was bound and determined to use integrated security!

Remember, I am a developer, not a “real“ dba or sysadmin!

What I learned, thanks to some help from a Dave Burke post and also a conversation with Brad Kingsley from Orcsweb on the ASPAdvice security listserv, was how to change the security account in IIS (Application Pool/Identity). Not only can you choose from one of the defaults, but you can also choose any of the server accounts (well, they may be filtered) but my IWAM_server account was what I wanted and knew how to work with so that’s what I chose. This cleared up all of my sql access problems, because I had set up that account when I installed SQL Server on that box. But, it was the NETWORK SERVICE account that had been given all of the appropriate permissions on my application folders. I started getting errors left and right when trying to run/debug my asp.net app. Not even on the folders where the application was, but the windows/.net framework/v…/aspnet temp  folder and other folders on my system drive (my app folders are on a separate drive.)

I started hacking – permission here permmission there, but the problem didn’t go away AND I did NOT like that I was doing this manually because I might have been creating another bad effect elsewhere. I did think later that maybe some tool like IISReg might have done this for me. I’m not saying this is a bad option. The nice thing here is that if you need to, you can have this type of granular control over IIS. Me – I don’t happen to need them, gimme those defaults and thank you for all of the automated setup!!!

But instead, I set everything back to the defaults, including the IIS security account, and went back to SQL Server. This time, in TSQL, I went to the master database and typed

sp_grantlogin ‘NT AUTHORITY\NETWORK SERVICE’

Problem solved. Now my asp.net was allowed to talk to SQL Server, then I just had to go into my database and give that account (now available in Ent. Mgr) access to what I wanted it to have access to.

UI – Resizing grid columns in Infragistics UltraWinGrid

I am working on a form and have to make sure that the columns all are the correct width for the maximum data that can be entered. Some cols may have data like “111” (which will require a wider column for “333”. Some cols may have “9999.9”. So in order to properly set the sizes, I created a handly little function that will not be on in run time, only design time. It just tells me what I have resized the column widths to, so that I can go back and apply the correct widths in my grid formatting code.

Private Sub UltraGrid1_AfterColPosChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterColPosChangedEventArgs) Handles UltraGrid1.AfterColPosChanged

MessageBox.Show(“col width=” & e.ColumnHeaders(0).Column.Width)

End Sub

If you have a boolean that indicates you are loading the form, you might want to wrap that around the messagebox function so you don’t get a popup for each cell as the form is rendering.

Not earth shattering, but a nice trick instead of guessing!