<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8939605</id><updated>2011-09-10T15:18:05.652-04:00</updated><title type='text'>Roger WillCode</title><subtitle type='html'>Programming. Life. Art. ASP.Net and VB.net. Self-employment. Self-delusion. Success (and not). Read on to see how all of this can co-exist in one blog much less one life!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8939605.post-117665772789147753</id><published>2007-04-15T13:03:00.000-04:00</published><updated>2007-04-15T13:41:42.703-04:00</updated><title type='text'>Why I Hate Windows Vista (Let me count the ways)</title><content type='html'>&lt;span style="font-family:arial;"&gt;This shouldn't be so difficult. I mean, its just a new OS. And visually, it's a complete rip-off of the Aqua/OSX stuff. And if it was difficult, there certainly would be some compelling reason to do it, right?&lt;br /&gt;&lt;br /&gt;Wrong and wrong again. Welcome to my Why I Should Say "Hasta La (to Windows) Vista" journal.&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;I'm a Windows developer who uses Visual Studio 2003. OK, stop right there. Windows 2003 isn't supported by Microsoft under Vista. You have to upgrade to 2005.  Don't I get some decision in this? Before being forced to upgrade to a new tool (btw, I tried this once and it trashed my app), isn't this a decison I should be making...not Microsoft?&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I attempted to install a new app which was created under VS 2005. But it didn't work. Turns out that VS 2005 isn't completely supported (but you can run it) but you first have to download and install a Service Pack for Visual Studio 2005 for Windows Vista. When you try to install that, it tells you (ok, its a little more like *implies* and you need to *deduce*) that you need to install SP1 for VS 2005 first (silly me! I thought the Vista patch would have already included SP! !) This took about three hours. They are big downloads and slow installs.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Something else that I noticed: the performance of Vista, to use a technical hardware term, &lt;span style="font-weight: bold;"&gt;sucks&lt;/span&gt;. I'm running Vista on a dual boot box with XP. So this is an apples-to-apples comparison (not actually apples...although I am seriously thinking of getting a Mac btw!)&lt;br /&gt;&lt;br /&gt;When you start an application, it takes...what seems like a LOOONG time to show you the next box -- which is the pesky "this requires a security clearance to run this app" dialog box. It was lightly amusing the first few times I saw it...but it gets tired real fast. In terms of stopping viruses, hackers and mutant DNA from playguing future generations, this is about as effective as keeping people with water bottles from flying on airlines (HEADLINE: Terrorists Train Camels To Outwit TSA Officials). But I digress.&lt;br /&gt;&lt;br /&gt;Even if this was a good idea, you very quickly get in the habit of saying YES b/c that's the only answer you ever give. It doesn't make me feel any safer (ibid for the TSA policy on water bottles and saline solution) and it is just annoying. And it takes time and keystrokes, too.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I finally get VS 2005 running with the new project. But I get an error message which (b/c I've been though some of this before) tells me (again, more like *implies* and you need to *deduce*) that ASP Framework 2.0 isn't there. But it is. Actually, IIS is what's missing.&lt;br /&gt;&lt;br /&gt;How do you install IIS?&lt;br /&gt;&lt;br /&gt;You *used* to be able to go to control panel /add remove programs / windows components. Now its Control Panel\Programs and Features\Turn Windows Features On and Off. I'm not sure about you, but when I visit the control panel, 90% of the time it was to use the Add/Remove programs features. So it was obvious and convenient that this was at the top of the alpha list. But that made sense. That was then. This is Vista.&lt;br /&gt;&lt;br /&gt;You can't just Add IIS as you could in XP. There's a rather dense and bewildering set of IIS 6.0 vs 7.0 features. I have no idea what I did but I did get IIS to run. Well, I think I did.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Now its time to create the virtual directory. Its all different -- and not necessarily an improvement. But somehow I fumbled along as was able to do this.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Time to run the app. Uh, oh, it doesn't run (what a surprise!).  But I get this trying to be clear in an obfuscating kinda way message:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;1) Migrate the application to work with the Integrated .NET mode  (PREFERRED).&lt;/h3&gt;You can migrate the application configuration, including the  contents of the &lt;httphandlers&gt; configuration section, by using the  following from a command line window (the window must be running as  Administrator):&lt;br /&gt;&lt;br /&gt;&lt;b&gt;%systemroot%\system32\inetsrv\APPCMD.EXE migrate  config "Default Web Site/"&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;After you migrate your application, it  will run in both Classic and Integrated .NET modes, as well as on downlevel  platforms. &lt;/httphandlers&gt;&lt;h3&gt;&lt;br /&gt;&lt;br /&gt;2) Move this application to an application pool using the Classic .NET  mode.&lt;/h3&gt;You can move the application to an application pool that uses the  Classic .NET mode by using the following from a command line window (the window  must be running as  Administrator):&lt;br /&gt;&lt;br /&gt;&lt;b&gt;%systemroot%\system32\inetsrv\APPCMD.EXE set app  "Default Web Site/" /applicationPool:"Classic .NET  AppPool"&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, you can use any other application pool on  your system that is running in the Classic .NET mode. You can also use the IIS  Administration tool to move this application to another application pool.&lt;br /&gt;&lt;br /&gt;OK, I'm not sure EXACTLY which Microsoft sin I committed, but clearly the penance involves running a program called appcmd.exe in the system32\IntetSrv folder of the Windows system folder. Guess what? That program is missing?&lt;br /&gt;&lt;br /&gt;I guess it's now time to try and google my way out of this and scan other people's rants and solutions on the subject.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-117665772789147753?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/117665772789147753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=117665772789147753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/117665772789147753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/117665772789147753'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2007/04/why-i-hate-windows-vista-let-me-count.html' title='Why I Hate Windows Vista (Let me count the ways)'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-114454797738221370</id><published>2006-04-08T21:52:00.000-04:00</published><updated>2006-12-21T11:16:01.643-05:00</updated><title type='text'>Firefox Misfires (but IE works? No way...)</title><content type='html'>What Steven Colbert says about the pope might also apply to Firefox: Even though its infallible, that still doesn't mean it can't make mistakes!&lt;br /&gt;&lt;br /&gt;Something compliant works in IE but doesn't behave in Firefox? Really? Go figure!&lt;br /&gt;&lt;br /&gt;A "no brainer" HTML / javascript failed to execute in FF. It's really rather simple: the user needs to click a graphic button and then execute a submit() from the onClick event. Works fine in IE, But for somereason, Firefox...fails.&lt;br /&gt;&lt;br /&gt;Its not the javacript. Inserting a alert() in the text for the onclick event creates the expected popup. Sort of seems like it just ignores/can't handle the rest of the command.&lt;br /&gt;&lt;br /&gt;The solution was to put the submit() in a separate function. For some reason, FF doesn't like to see a submit() in a onClick event for a html control.&lt;br /&gt;&lt;br /&gt;Live and learn. And recode. (That's my motto!)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-114454797738221370?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/114454797738221370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=114454797738221370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/114454797738221370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/114454797738221370'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2006/04/firefox-misfires-but-ie-works-no-way.html' title='Firefox Misfires (but IE works? No way...)'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-113363231158915276</id><published>2005-12-03T12:51:00.000-05:00</published><updated>2005-12-29T16:10:14.640-05:00</updated><title type='text'>Connection Leaks (call the plumber? Not that kind of leak)</title><content type='html'>Its a quiet Saturday morning and I'm minding my own business, trying to catch up on my "things to do list" which has items on it dating back to the French Revolution. When suddenly, in a blinding flash of the unexpected, my whole core understanding of ado.net unravels and disintegrates.&lt;br /&gt;&lt;br /&gt;Don't worry. I recovered. With no thanks to Microsoft and a very sincere Hurrah to blogger &lt;a href="http://blogs.msdn.com/angelsb/default.aspx" target=_new&gt;Angel Saenz-Badillos&lt;/a&gt; for his post about "Connection Pooling and the &lt;em&gt;Timeout expired&lt;/em&gt; exception" FAQ.&lt;br /&gt;&lt;br /&gt;If it sounds esoteric, well it is. Except when yor Life and your application come crashing down because of it!&lt;br /&gt;&lt;br /&gt;Back in asp classic, Mr or Ms Programmer was responsible for destroying objects when they were done with them. Mostly by setting things to "nothing." (I know, if you aren't a programmer dude or dude-ess, this makes no sense. But stay with me...) One of the advantages of asp.net and ado.net was that you didn't need to do that anymore; when you existed a routine anything created by that sub or function was automatically closed and destroyed.&lt;br /&gt;&lt;br /&gt;Except, apparently, for pooled functions.&lt;br /&gt;&lt;br /&gt;If you see a message like&lt;br /&gt;&lt;blockquote&gt;You used more than Max Pool Size connections (Max Pool Size default=100) &lt;/blockquote&gt;it means you haven't closed your connections...and they have accumulated to the breaking point (at least as far as your server is concerned!) The solution is pretty simple, just close em when you are done! If you are using a Try/End Try structure add this code to the Finally and the Ex as exception branches:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;adpSQLAdapter.SelectCommand.Connection.Close()&lt;br /&gt;cnSQLConn.Close()&lt;/blockquote&gt;You want to be sure to add this to the Exception as well as the Finally branches so you will close connections that abend. This should avoid creating &lt;em&gt;connection leaks&lt;/em&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-113363231158915276?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/113363231158915276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=113363231158915276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/113363231158915276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/113363231158915276'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2005/12/connection-leaks-call-plumber-not-that.html' title='Connection Leaks (call the plumber? Not that kind of leak)'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-113350072793623927</id><published>2005-12-02T00:18:00.000-05:00</published><updated>2005-12-02T00:18:47.936-05:00</updated><title type='text'></title><content type='html'>Here' s one for the ages. When is a bug not a bug?&lt;br /&gt;&lt;br /&gt;When MS posts it but it doesn't affect you.&lt;br /&gt;It only becomes a bug when it mysteriously and chronically appears to inflict pain, suffering loss of work and sleepless nights. Usually without warning!&lt;br /&gt;&lt;br /&gt;OK, there may have been a clue of warning here; everything seemed to be going fine until a "hotfix was installled on my windows 2003 server. They send it; we install it *Security alert!* What's not to like?&lt;br /&gt;&lt;br /&gt;Except MS is pretty sparse when it comes to explaining what's included in each HotFix.&lt;br /&gt;&lt;br /&gt;Anyway, shortly after that, mysteriously, VB.net app stopped being able to connect to my server. While stepping through the app I discovered this error returned when the connection was being opened: SQL Server does not exist or access denied.&lt;br /&gt;&lt;br /&gt;It was pretty weird. Query analyzer Worked. Enterprise Manager worked. I tried changing the connect string to use the sa login but that was also to no avail. And a visit to the MS monitored sql server newsgroup didn't help very much, either.&lt;br /&gt;&lt;br /&gt;Finally, I ran across this "bug" in &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;315159"&gt;KB article 315159 &lt;/a&gt;at Use Transmission Control Protocol/Internet Protocol (TCP/IP) instead of the named pipes protocol to connect to the database. To do this, add the following attribute to the connection string: Network Library=dbmssocn&lt;br /&gt;&lt;br /&gt;That addition -- and changing the connect string from using the server name to the IP address seemed to make everything work. I'm monkeying with the hosts file at C:\WINNT\system32\drivers\etc to try to work around that problem right now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-113350072793623927?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/113350072793623927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=113350072793623927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/113350072793623927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/113350072793623927'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2005/12/here-s-one-for-ages.html' title=''/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-110413937829829829</id><published>2004-12-27T04:03:00.000-05:00</published><updated>2005-12-02T00:29:56.563-05:00</updated><title type='text'>SMTP: Sending mail from asp.net</title><content type='html'>&lt;span style="font-family:arial;"&gt;"Easy to do" is easy to say. Ah. If I only had a dime for everytime I thought something was a "piece of cake" and it later turned out to be a "piece of sh..." (you get the idea.)&lt;br /&gt;&lt;br /&gt;OK, this should be easy. But based on doing this TWICE and seeing others frustrations with this issue, its apparently something that usually runs without a hitch on the client, offline test machine and then usually implodes when you port it to a web server on the Internet.&lt;br /&gt;&lt;br /&gt;Read along for my tail of woe.&lt;br /&gt;&lt;br /&gt;Its not too bad to implement in asp.net. Just create a mail object, populate its properties and and the send method. Hereis some quickie code to do that.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Dim objMM As New System.Web.Mail.MailMessage()&lt;br /&gt;With objMM &lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;.To = "&lt;a href="mailto:you@blahblah.org"&gt;&lt;span style="font-family:arial;"&gt;you@blahblah.org&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;"&lt;br /&gt;.From = "me&lt;/span&gt;&lt;a href="mailto:me@blahblah.org"&gt;&lt;span style="font-family:arial;"&gt;@blahblah.org&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;"&lt;br /&gt;&lt;br /&gt;'Send the email in format&lt;br /&gt;.BodyFormat = Mail.MailFormat.Html&lt;br /&gt;'Set the priority - options are High, Low, and Normal&lt;br /&gt;.Priority = Mail.MailPriority.Normal&lt;br /&gt;&lt;br /&gt;'Set the subject&lt;br /&gt;.Subject = "Your subject goes here"&lt;br /&gt;&lt;br /&gt;'Set the body - use VbCrLf to insert a carriage return&lt;br /&gt;.Body = "stufff goes here" &lt;/p&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:arial;"&gt;End With&lt;br /&gt;&lt;br /&gt;' Note changing this value affects the smptserver value for everything on this server!&lt;br /&gt;&lt;br /&gt;Mail.SmtpMail.SmtpServer = "yoursmtpserver.mail.net"&lt;br /&gt;Mail.SmtpMail.Send(objMM)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;The problem occurs when you move this to the web. You need to make sure the smtp service is turned on. And sometimes you can use a legit smtp mail server as you would use in Outlook, Eudora and other mail clientts. But you often get a frustrating message about &lt;em&gt;"Could not access 'CDO.Message' Object"&lt;/em&gt; which implies a permissions problem. This might be the case. But then again, it might not!&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;I most recently solved it by following the advice posted at &lt;/span&gt;&lt;a href="http://www.systemwebmail.com/faq/4.2.3.aspx"&gt;&lt;span style="font-family:arial;"&gt;http://www.systemwebmail.com/faq/4.2.3.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt; and changing the smtpserver property of the mail object:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;Mail.SmtpMail.SmtpServer = "127.0.0.1" &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;You will also need to make sure that relaying is turned on in the smtp properties.&lt;br /&gt;(Manage computer; Services; IIS, Default SMTP virtual server; Access tab; Relay restrictions and check "allow all computers that succcessfully authenticate to relay regardless of the list above."&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;-------------------------&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;This is just terrible!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;My whole goal of creating this blog was to write down stuff that I always forget.&lt;br /&gt;Now the worst thing has happened. I forgot that I wrote it down!&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;I just saw the msg on one of my client's sites about the can't access CDONTS. And I forgot that I posted this fix!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;OK, next time you see this, don't forget to go to &lt;a href="http://www.systemwebmail.com/faq/4.2.3.aspx"&gt;http://www.systemwebmail.com/faq/4.2.3.aspx&lt;/a&gt; for the complete answer about giving yourself access writes to this box for smpt.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;ugh! (upadted 3/1/05)&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-110413937829829829?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/110413937829829829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=110413937829829829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/110413937829829829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/110413937829829829'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/12/smtp-sending-mail-from-aspnet.html' title='SMTP: Sending mail from asp.net'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-110285978806043159</id><published>2004-12-12T08:47:00.000-05:00</published><updated>2004-12-12T08:57:37.280-05:00</updated><title type='text'>Hello! Who's Out There? (or finding visitor ip addresses in asp.net)</title><content type='html'>&lt;span style="font-family:arial;"&gt;Hello, again. Too busy to code to have time to post. Or maybe its just that I havne't learned anything new lately. (That's a depressing thought!)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Spent a day implementing an old piece of asp classic code that *didn't quite work* as expected in asp.net. Maybe it was case sensitive. Maybe I was sleep deprived. Don't care. Its finally done! Here's the short story.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;To find out and save the ip address of your site visitor, include &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Request.ServerVariables("REMOTE_ADDR")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;in your code. but that won't always work. If your visitors come in from a proxy server (those sneaky bastards!) this column will be blank. Thanks to a post on SmartPanda from Ray Gap at &lt;/span&gt;&lt;a href="http://www.smartpanda.com/articledetail.aspx?id=10"&gt;&lt;span style="font-family:arial;"&gt;http://www.smartpanda.com/articledetail.aspx?id=10&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt; we have a one-size-fits all solution:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;' the ip address will be in another servervariable if it is a proxy server&lt;br /&gt;Dim sUserIp As String = Request.ServerVariables("REMOTE_ADDR")&lt;br /&gt;If sUserIp = "" Then sUserIp = Request.ServerVariables("HTTP_X_FORWARDED_FOR")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;As you can see, first we try ("REMOTE_ADDR") and if that is blank we then use ("HTTP_X_FORWARDED_FOR").&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Piece of cake (once you know that recipe, of course!)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Roger Willcode,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;over and out.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;ps: Reward for hard work. Now off for a ride (Sun Dec 12, 8:55am, 43 degrees F. Definitely a nominee for the national chairperson of the "Get A Life" Club....hmmmm :&gt;))&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-110285978806043159?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/110285978806043159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=110285978806043159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/110285978806043159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/110285978806043159'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/12/hello-whos-out-there-or-finding.html' title='Hello! Who&apos;s Out There? (or finding visitor ip addresses in asp.net)'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-109923330543513719</id><published>2004-10-31T09:16:00.000-05:00</published><updated>2005-12-02T00:33:38.790-05:00</updated><title type='text'>How to Automatically Print from a Web page in asp.net</title><content type='html'>&lt;span style="font-family:arial;"&gt;Everyday you should learn something new. Yesterday I learned two things. Does that mean I can take the week off?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In good 'ol asp, or perl or whatever, it was pretty easy to invoke a print from javascript. That's because men the client side was the client and the was the server. In .net, its sometimes clear...as mud. And "easy to do" is often *only* easy to say.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In straight vanilla html with javascript, you can assign this "script" to the onclick event of a link or button (if its a link you will want to set the href="#" or null or something like that)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;a href="#" onClick="javascript:window.print()"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;But it isn't as simple in asp.net. You can't just put that code in the browser. You can, but it will print the page you are looking at. What if you want to provide a link for a "print frinedly format," that regenerates the page without links and invokes the printer without asking the user to click for a second time?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;Here's what you need to do.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;Add an ID to the body tag of the document. In this example, mytag is &lt;strong&gt;bodyID. &lt;/strong&gt;You wil also have to tell asp.net to make this a server side thing other wise it will never show up in the IDE.&lt;br /&gt;&lt;br /&gt;body id=bodyID runat=server&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;Add a reference in the code in the class declarations (before you get to the page_load procedure) that lets asp.net recognzie what you just did to the html.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Protected WithEvents bodyID As System.Web.UI.HtmlControls.HtmlGenericControl&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;Now, *finally* you can make a call to this tag in your code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;bodyID.Attributes("onload") = "javascript:window.print()" &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;Now wasn't that easy and intutiive ("surely you must be joking mr. feyman....")&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;Roger Willcode&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-109923330543513719?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/109923330543513719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=109923330543513719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109923330543513719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109923330543513719'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/10/how-to-automatically-print-from-web.html' title='How to Automatically Print from a Web page in asp.net'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-109922894108725125</id><published>2004-10-31T08:15:00.000-05:00</published><updated>2004-10-31T09:12:56.226-05:00</updated><title type='text'>Magic. Evolution. Revolution. Ben Franklin, Houdini, Mao and Picasso, too.</title><content type='html'>&lt;span style="font-family:arial;"&gt;What's cool about coding is that it's one of those rare pursuits where you can be both Charles Darwin and Harry Houdini. With a little Bobby Fischer, Picasso and Thomas Edison thrown in. All without leaving your desk.&lt;br /&gt;&lt;br /&gt;Unfortunately, sometimes for what seems like 24 hours at a time.&lt;br /&gt;&lt;br /&gt;Too many characters to cover in one post. So let's start with the &lt;a href="http://www.harryhoudini.com/" target="_new"&gt;Mr. Houdini&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Programming and magic have alot in common. In both pursuits, you practice to perfection mechanial tasks and behind the scene procedures which the audience will never see. And when both are done well, they are designed to get a big &lt;strong&gt;&lt;em&gt;wow&lt;/em&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;A good magician is concerened with the total effect. Same for a good UI (user interface) designer. In the best designs, you reach for a feature -- that you didn't consciously think was there -- and it does exactly what you expect. Or even better, anticipates what you wanted before you knew that you wanted it. I think that's what you expect from a good butler or a conceierge (although I would hardly know from personal experience!)&lt;br /&gt;&lt;br /&gt;In the well rehearsed magic trick that leaves you with a &lt;strong&gt;&lt;em&gt;wow&lt;/em&gt;&lt;/strong&gt;, you don't really know how they do it, because all of the details and mechanics behind the act are hidden. All you see is the result. Suspension of belief. But it impresses you becuase of the 1) unexpected result and 2) disconnect between process and result. (&lt;/span&gt;&lt;span style="font-family:arial;"&gt;Hopefully, most software development embraces #2 as a goal and avoids #1 as much as possible.)&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;And good magic is what I'm trying to do. And because I never could get the hang of hiding the rabbit in my hat, this will have to do.&lt;br /&gt;&lt;br /&gt;However, magicians rarely get to take on the roles of Darwin, Benjamin Franklin, Mao while playing Sim City for a living. So programmers still have a few bennies on their side.&lt;br /&gt;&lt;br /&gt;More to come on that.&lt;br /&gt;&lt;br /&gt;Roger Willcode, over and out (and back to work). &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-109922894108725125?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/109922894108725125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=109922894108725125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109922894108725125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109922894108725125'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/10/magic-evolution-revolution-ben.html' title='Magic. Evolution. Revolution. Ben Franklin, Houdini, Mao and Picasso, too.'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-109914735478378839</id><published>2004-10-30T13:41:00.000-04:00</published><updated>2004-10-30T10:53:05.323-04:00</updated><title type='text'>The adventure begins. My Life With Asp.net (vb.net)</title><content type='html'>&lt;span style="font-family:arial;"&gt;"Call me Ishmael. Some years ago - never mind how long precisely...I thought I would sail about a little and see the watery part of the world."&lt;br /&gt;&lt;br /&gt;Yeah, its the opening from Moby Dick. A little trite, perhaps. But there are some days where I feel like I am tailing the great white whale (Microsoft?). Always getting closer to the beast, ready with my mouse in hand to harpoon the latest dot net feature and step around the latest bug or security hole, always vigilant for time when the Great Whale will turn on me.&lt;br /&gt;&lt;br /&gt;Which it seems to do, without reason several times a week.&lt;br /&gt;&lt;br /&gt;(in re reading this, I briefly considered changing the reference from &lt;i&gt;White Whale&lt;/i&gt; to &lt;i&gt;White Elephant&lt;/i&gt;. Whatever.)&lt;br /&gt;&lt;br /&gt;OK, on to today's discovery.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How do you change the title of an HTML page in .net? That would seem like a POC (piece of cake) right? After all, you really get very col and powerful control features over virtually every part of the HTML page. When you get the hang of it, its pretty impressive.&lt;br /&gt;&lt;br /&gt;Except for this one. It works. But its a bit of a feat to find it.&lt;br /&gt;&lt;br /&gt;Short answer: Add this line to your class declarations BEFORE the pageload, etc:&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Protected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl&lt;/span&gt; &lt;/span&gt;&lt;/strong&gt;&lt;/blockquote&gt;&lt;span style="font-family:arial;"&gt;Now you change the title dynamically anywhere in your document with this statement:&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;pageTitle.InnerText = "My New and Arbitrary Title"&lt;/span&gt;&lt;/strong&gt;&lt;/blockquote&gt;&lt;span style="font-family:arial;"&gt;Now was that so difficult? Why did I have to spend 20 minutes sesarching in vain in MS documentation? Am I the ONLY one who ever thought to do this before? I'm not that stupid' I tried searching under document, title, html. No dice.&lt;br /&gt;&lt;br /&gt;Credit where credit is due: here's the post which solved the mystery.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.dotnetspider.com/technology/kb/showsample.aspx?sampleid=12&amp;cachekey=2211"&gt;&lt;span style="font-family:arial;"&gt;http://www.dotnetspider.com/technology/kb/showsample.aspx?sampleid=12&amp;amp;cachekey=2211&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;Thank you, whoever you are.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-109914735478378839?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/109914735478378839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=109914735478378839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109914735478378839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109914735478378839'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/10/adventure-begins-my-life-with-aspnet.html' title='The adventure begins. My Life With Asp.net (vb.net)'/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8939605.post-109915024467844438</id><published>2004-10-30T11:17:00.000-04:00</published><updated>2004-10-30T11:45:51.263-04:00</updated><title type='text'>My first reissue (of my first post. Jeez!) </title><content type='html'>&lt;span style="font-family:arial;"&gt;Subject: HTMLGenericControl changing the HTML Page title.&lt;br /&gt;&lt;br /&gt;OK, that didn't work. But I can't blame the helpful post that I copied; I only copied part of it (deep sigh).&lt;br /&gt;&lt;br /&gt;If you do what I told you, you get one of those "can't populate object." (that's exactly not it, but I'm not about to recreate the error just for BlogLand).&lt;br /&gt;&lt;br /&gt;You need to tell dopey dot.net to run this puppy as a server control. So in addition to the previous post, change the title tag to read:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;title id="pageTitle" runat="server"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;This should fix it.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;And here's a little rant for our hosts at blogspot. Why can't I include the "&lt;" and the "&gt;" in my posts? Yes, I even tried editing the HTML and changing them to &lt;&gt; but it gave me an error (ok, it was a nice trap. Good save!) but deleted all of my copy after the error (and it was my first, deep introspective commentary, too!)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OK, blog and learn. Or something like that.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Roger, WillCode. Over and out.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8939605-109915024467844438?l=willcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://willcode.blogspot.com/feeds/109915024467844438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8939605&amp;postID=109915024467844438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109915024467844438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8939605/posts/default/109915024467844438'/><link rel='alternate' type='text/html' href='http://willcode.blogspot.com/2004/10/my-first-reissue-of-my-first-post-jeez.html' title='My first reissue (of my first post. Jeez!) '/><author><name>Roger WillCode</name><uri>http://www.blogger.com/profile/18261656081211787278</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='19' height='32' src='http://tngresearch.com/RogerWillCodeForFood.jpg'/></author><thr:total>0</thr:total></entry></feed>
