Configuring WCF with BasicHttpBinding and SSL
Despite a variety of posts on this topic, I had to go through a bunch of articles just to get what seemed to be a simple task.I started with this post How to setup a WCF service using basic Http bindings with SSL transport level security. The post gives a good explanation of how to get a ssl certificate and set up IIS to use the certificate. In my case, I just wanted to use SSL and not credentials. So I modified the web.config like this: ...
Getting random rows from Sql Server
I'm working on a project where I want to return related content. The sproc I wrote seems to work ok but because I was sorting by the insert date or the title, it would always return the same thing for all content closely associated.So how do I get it to return only the closely related content AND randomize it?Here is the what I did: SELECT * FROM #tmpRelated JOIN Content c ON r.ContentID = c.ContentID ORDER BY r.TotalRelevance DESC, ...
Neat way to handle Nullable types …
Ever since I read Rick Strahl's blog post on the C# ?? operator, I've been in love with the C# ?? operator. Mostly I use it as a clean way to test a ViewState variable for null in a property. For example, protected string stringToPersistOnPostBack { get { return (ViewState[this.ClientID + "_stringToPersistOnPostBack"] ?? "").ToString();< } } Somewhere along the way, the real purpose of the ?? operator was ...
Web Dev Best Practices
This has come up in various conversations recently and I was bored so I was googling for html best practices. I thought this article from Apple was quite good.
Forcing ASP .Net Validators and ValidationSummary to use CssClass
Here's something strange. If I create a validator using the following mark up: <asp:requiredfieldvalidator id="rfv_txt" runat="server" errormessage="Required" CssClass="errorText" /> and my css class is: errorText { color: purple; } My validator still renders with red text. Checking the markup, I see that ASP .Net has added an inline style attribute (style="color: red"). Obviously, inline styles take precedence over class ...