Office365 SMTP settings

I just switched to Office365 for my hosted exchange needs and it's great.  I needed to switch my blog over but couldn't figure out what SMTP address to use.  Well here it is:

 

1.  Log onto the online services portal here

2.  Click on Outlook

3.  Click options in the upper right corner

4.  Click on About

5.  Find "External SMTP" and there you have it:  Server name and port.

Debugging a Silverlight application using Firefox

I use Firefox as my default browser.   I want to debug Silverlight 4 from Visual Studio 2010.  But I keep getting the empty red circle and the message that no debugging symbols have been loaded.   I found this post from Tim Heuer that helped, but it was written a year and a half ago and it didn't work completely. Firefox has released so many versions since then, it's hard to keep up.  For whatever reason, dom.ipc.plugins.enabled.npctrl.dll was not in my list of preferences.  So I added it!  Works like a charm: 

  • type about:config in the firefox address bar
  • read the warning
  • if dom.ipc.plugins.enabled.npctrl.dll is not on the list, add it.  If it is, change the value to "false"
  • restart FF

Thanks to Tim for this!

There's gotta be somebody this has helped! 

Scott

Install a self-signed certificate as a trusted root CA on Windows 7

So here's my situation - using Oracle's VirtualBox, I created an instance of Windows Server 2008 R2.  I installed IIS 7.5, created a new web site, checked out my code from my subversion repo and got some WCF services running.  Because I need SSL, I created a self signed certificate.  Easy enough to do, just go into IIS Manager, click on the root server node and on the right hand side under Actions, click "Create Self-Signed Certificate".   An excellent source that I followed is in ScottGu's blog

So my services are browsable now inside my virtual machine but outside, I get an security warning inside my browser:

 

 

This is because my self-signed certificate is not from a trusted root CA, which means it wasn't assigned by a well-known, trusted organization.  So here is the solution.  You need to install your self-signed certifcate into the Trust Root Certification Authorities Store. 

Step 1:

Bring up your site in your browser (I use IE9) and click on "Continue to this website (not recommended)".  Then you should notice a certifcate error next to the address bar.  Click on that.  Then select View certificates.

 

Step 2

You'll see this.  Click "Install Certificate".

 

 

Step 3

This launches the Certificate Import Wizard.  Chose the option to place all certificates in the following store and select browse:

 

 

Step 4

Choose Trusted Root Certification Authorities.  Then click Ok, then Next, then Finish.

 

Step 5

You'll get a security warning dialog.  Basically says that Windows can't be sure of the origin.  But you know it's legit since you created it.  So select Yes. 

 

 

It will then tell you it was successful.

Step 5

Verify that your certificate has been installed by loading the certificates snap-in in MMC. 

 

 

Now close down your browser, restart, and call up your site.  No more security warnings.

Hope that helps somebody.

Scott

How to change the registered user name and organization in Visual Studio 2010

By default, mine show Microsoft for the user name and Microsoft for the organization and I don't get a change to set these during installation.  This could be due to the fact I am using the MSDN version.  So who cares if it shows Microsoft?  I do!  When you create a new project, your AssemblyInfo file pulls in this information and I always have to change it for my published applications.

Here is a reference to where you change this at:

http://blogs.msdn.com/b/vsnetsetup/archive/2010/05/11/the-visual-studio-2010-help-about-dialog-box-and-the-splash-screen-shows-registered-username-and-registered-organization-as-microsoft.aspx

I have the 64 bit version of Windows 7, so I followed those instructions.  Worked great.  It's basically 2 registry settings and then running devenv.exe /setup from the command prompt (make sure you run as an administrator!)

On a x86 bit (32 bit OS) computer follow the below path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Registration\UserName
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization

On a x64 bit (64 bit OS) computer follow the below path:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Registration\UserName
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization     

Then to fix the splash screen:
On a x86 bit (32 bit OS) computer follow the below path:
"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup

On a x64 bit (64 bit OS) computer follow the below path:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup     

Hope that helps somebody.

Scott

Include a data file in a ClickOnce deployment

I have published several WPF applications using ClickOnce.  This is great because I can direct my users to a web page and they can just click a button and run their app.  Today, I needed to deploy a new application that uses a .xml file as input to a process.  I deployed it a half dozen times, all unsuccesfully because they didn't include my .xml file.

The solution:

Change the build action to "Content". 

 

Verify by looking at your Application files on the Publish tab of your project's properties. 

 

Comments not working

I just found out comments are not working on my blog since I upgraded to blogengine 2.0.  I am going to try and figure this out.

 

EDIT:  Comments should be working now.  It was a permissions issue on my server.

A wide open clientaccesspolicy.xml file for developers

I recently installed some new WCF services on a different domain with SSL.  I was previously running them locally without SSL.  I know that I need a clientaccesspolicy.xml file to allow for cross-domain access.

I copied the one from microsoft here: http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx

But that wouldn't work.    

 

The error I kept getting was:

An error occurred while trying to make a request to URI 'https://api.myservice.com/myservice.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

The solution is to explicity add a https://* to the cross domain policy.  This actually is in the above Microsoft link, but I missed it!  I replaced <domain uri="*"/> with <domain uri="https://*" /> and it works now.

This is the file I'm using now.  

 One note: I've also got a domain uri for regular http://.  I don't need http:// access, but it won't work without it.  I am not going to spend time trying to figure that out right now, but I hope this helps somebody.

Scott

Upgraded to BlogEngine 2.0 RC

This installation was perfect!  Since I don't have any customizations, I just backed up my folder, installed the new version and then copied over my App_Data files (I don't run this blog off a database currently).  Cheers!

http://www.dotnetblogengine.net/

Scott

 

 

The SilverLight Developer Runtime Not Installed

How frustrating..it happened to me again today.  I downloaded some MVVM examples that Dan Wahlin recently put together for a talk on LIDNUG.  I loaded them up and hit F5.  At this point, my fingers are always crossed because usually projects do not run right of the bat without some tinkering.  This one compiled and started up IE and then gave me a small messagebox saying my version of Silverlight 4 needed updating.  So of course I downloaded the newest version thinking it was a fine and dandy.  Nope.  On the next press of F5 I got:

"Unable to start Debugging.The SilverLight Developer Runtime Not Installed. Please Install a matching version"

I've done this twice now.  I downloaded the end-user version of the runtime and that messed up my installation of the developer version.  So the solution is to re-install the developer version here:

http://go.microsoft.com/fwlink/?LinkID=188039

thanks to this post for saving my day.  Again.

 

 

ViewStateMode is a great addition to ASP.NET 4.0

I've never paid much attention to ViewState, but it's a pretty cool thing.  It is a technique used by an ASP.NET Web page to persist changes across postbacks.  Before posting back, all your data is stored in a hidden form field called __VIEWSTATE.  That way when the page is rebuilt, your dropdown, textbox, label, etc data will still be there.  You can read more in depth here, but it's just always worked and I haven't had concern for the huge payload that it can sometimes bring.  Maybe that's why my bandwidth usage on my old e-commerce site is out of control! 

Well now I'm paying attention and ASP.NET 4.0 gives us a new tool to help control ViewState, the ViewStateMode property.  Say I have a dropdown where I select the quantity of a product that I want to buy.  I then click "Add to Cart".  Well, what happens when I click that button is that the page rebuilds itself and the code on my "Add to Cart" button is run.  If I have ViewState turned off for my dropdown, when it comes time for run the "Add to Cart" code, the dropdown won't have any items in it!  In fact, this happened to me today and I realized that I had ViewState turned off.  By default, ViewStateMode is set to "Inherit", so all my child controls, including the quantity drop down wasn't saving it's values in ViewState.  A simple change of the ViewStateMode property to "Enabled" fixes the problem and everything is happy.

See for yourself here in this sample project

Markup:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestViewState.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="pnlViewState" runat="server" ViewStateMode="Disabled">
            <asp:DropDownList ID="DropDownList1" runat="server" ViewStateMode="Enabled" />
            <asp:Button ID="Button1" runat="server" Text="Postback" OnClick="Button1_Click" />
        </asp:Panel>
    </div>
    </form>
</body>
</html>

Code Behind:

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TestViewState
{
    public partial class Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.Items.Add(new ListItem("1", "1"));
                DropDownList1.Items.Add(new ListItem("2", "2"));
                DropDownList1.Items.Add(new ListItem("3", "3"));
                DropDownList1.Items.Add(new ListItem("4", "4"));

                DropDownList1.SelectedIndex = 2;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DropDownList1.SelectedIndex = 3;
        }
    }
}

 

By enabling ViewStateMode on my dropdrown list, it persists the values so that they are available when posting back.   To test this out, set ViewStateMode="Disabled" on the dropdown list and set a breakpoint on the Button1_Click event.  Then run the project.  Click the postback button and you'll see that DropDownList1 doesn't have anything in it!  Change back to "Enabled" and you'll see everything works.

By setting the ViewState on individual controls, you can really cut down on your payload on each postback.  This is a great addition in ASP.NET 4.0

Get the code for this project here:

TestViewState.zip (19.98 kb)