Today I spent some time discovering how to make webrequests in .NET. I'm noticing a pattern emerging with this .NET stuff. It takes me a long time to figure out how something works. Usually I find examples on the internet, probably 75% of those wind up being straight out of the MSDN documentation and the rest is found on other sites that Google finds me.
The slowest part of today was overcoming the 401 authentication problem I was having in accessing a secure internal server. The solution appears to be a combination of preauthenticate and using the correct method to call in the webrequest. I'll post the successful code when I'm writing from my other computer. This reminds me of a second pattern I find when trying to code with .NET: there are many valid looking ways to accomplish a task, but, as with all coding languages it tends to be quite particular about which one you use. Many of the examples I found off of MSDN were wrong for me. And the ones on MSDN carefully demonstrate only the methods of the current topic. The trick seems to be identifying the methods that associate to accomplish the task you want. Anyway, it's all in good fun.
The upshot is that I now feel capable of tapping data from the web via my applications. This has been a goal of mine, so I feel good about that.
I've found some more regex resources
http://www.thecodeproject.com/
This seems to be a cool place because they often (always?) provide the source for their apps. And there are several regex testers available for download in C# and VB.NET.
Currently nagging the back of my mind: How to search and replace a strange character from inside an Excel file? (Without buying a utility to do it. ;))
No comments :
Post a Comment