Thursday, December 31, 2009

Wife’s Site – Post Launch

Mostly everything went smooth today. There were a couple of things I had to go in and fix and get to setup. Primarily the RSA keypair so I could encrypt the web.config settings.

I also had to setup a configSection for flickrNet and point the cacheLocation to a folder on the server. Apparently it defaults to the local appdata under a FlickrNet folder for the current user. Well obviously on the server it doesn’t have access to do such a thing so you have to specify the cache folder. It was a simple fix, just unexpected. Once corrected, it looked like this:

section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet"/>

<flickrNet cacheLocation="e:\\myflickrcachepath"/>

We were also monitoring the Google Analytics and noticed that her /portfolio URL was still being hit quite a bit and the new site redirects to a 404 error page, which I have not formatted yet…just need to apply the style. We didn’t want to lose the traffic, so I thought…hey this is an easy fix with a new route! So here it is:

new {Controller="Portfolio", action="Index", name="families"});

Basically this says when you see /portfolio, go to the most popular gallery. Done! In webform ASP.NET, I would’ve either created a redirect page or setup a virtual directory that just redirects…I like this way much more…all in one place!

What else…I went through and added the title to my top navigation. Since I’m new to the RouteLink, I just forgot to add the title attribute. I did that and here’s a sample of one:

<%=Html.RouteLink("families", "Portfolio", new { name = "families" }, new { title = "families" })%>

On the top navigation, I also ended up opening a new window for the “share on facebook”. It appears to me that their UI was designed to be a pop-up and the flow wasn’t easy to me because you couldn’t simply hit back to get back to our site. I know it’s not the best practice for accessibility, but it was really annoying. Hopefully whoever is annoyed by it will forgive me.

Oh, I had an error on the contact page, which was caused by me not passing the model back into the view from my Success ViewResult on the SmartController. I ended up just creating a new SuccessWithPhotos<TModel> that returns a ViewResult like this:

protected ViewResult SuccessWithPhotos<TModel>(TModel viewModel, Enumeration photoViewType)
where TModel : PhotoView
return ViewWithPhotos(viewModel, photoViewType);

Whereas before, I was just returning a View(). If you’re curious what the ViewWithPhotos looks like, here it is:

        protected ViewResult ViewWithPhotos<TModel>(TModel viewModel, Enumeration photoViewType)
where TModel : PhotoView
viewModel.Photos = _photoRepository.GetPhotosFor(photoViewType);
return View(viewModel);

Again, if curious about Success, it is a protected method on the SmartController, which SmartPhotoController inherits from and this is all it does:

protected void Success()
"success"] = "";

I like it simple! If you’re wondering why I just set an empty ViewData, the reason is that it was the easiest way for me to control when to display a success message. Let me show you…I created an extension for the HtmlHelper called DivSuccessMessage and it looks like so:

public static string DivSuccessMessage(this HtmlHelper html, string successMessage)
if (html.ViewData.ModelState.IsValid && html.ViewData["success"] != null)
return "<div class=\"success-message rounded\">" + successMessage + "</div>";

return "";

On my contact view, I just have this:

<%=Html.DivSuccessMessage("You have successfully contacted Amy Schilling Photography.") %>

It was a really simple way to show a message without a lot of work. If there is a better way, PLEASE let me know! Anyhow, I think the contact form was probably my biggest mistake and I should’ve just finished out with my tests and I would’ve never had that problem. I didn’t though so I had the issue…live & learn! Alright, so carrying on…

I ended up having an issue with IE7 apparently. It was pointed out by an awesome friend of mine and I think I have that fixed, it was just a float issue I think…I’m actually still waiting to hear back from her to let me know if it’s fixed.

I found another issue with the email function when you sign up for the newsletter. So I started investigating it further and it turned out to be an issue with my StructureMap configuration. Once again if I had written the tests before hand, I probably wouldn’t have this issue. Oh well, I came up with a solution that I’m okay with until one of the StructureMap geniuses is able to help me out. Here’s my helper solution fix:

public static IMailingListSubscriber GetSubscriberWith(IMailNotification notification)
return new MailingListSubscriberWithNotifier(DependencyRegistrar.Resolve<IMailingListSubscriber>(), DependencyRegistrar.With<IMailNotification, INotificationService>(notification));

So I couldn’t get StructureMap to create that exact statement above for me without making it look crazy confusing and hard to read, so I went this simpler route. Since I made this little helper, I can easily change it up when I do find the StructureMap solution. The other thing I had to change was the ForRequestedType<IMailingListSubscriber> in the Registry. Now it looks like this:

//.EnrichWith(x => new MailingListSubscriberWithNotifier(x, new EmailNotificationService(new JoinMailingListNotification())));

I commented out what wasn’t working for me so I can go back to it later when I find the solution.

Alright, so I think that is everything that went wrong today…not too shabby :)

Thanks for reading and please continue to give feedback!

kick it on

blog comments powered by Disqus
Related Posts Plugin for WordPress, Blogger...