Month: March 2014
-
Rendering a View to a String – Email Templates in MVC4
Hey everyone, This is just a short post showing how to render views as strings. I’ve used this as a quick way to generate email templates. The logic to render a view as a string is as follows: public static string RenderRazorViewToString(Controller controller, string viewName, string content) { controller.ViewBag.Content = content; using (var sw =…
-
Redirect to Root – C# MVC4
Hey everyone, Just a quick one, how to redirect to root from a controller: return Redirect(Url.Content(“~/”)); For more info, checkout this Stackoverflow post: http://stackoverflow.com/a/10292039/522859
-
Twitter Bootstrap – Carousel Only CSS
Hey everyone, I ran into a bit of an issue today with my stylesheet conflicting with Bootstrap. After a bit of tinkering I realised that all I really needed from bootstrap were the Carousel styles. I’ve taken everything else out and included everything that’s left below: .carousel { position: relative; } .carousel-inner { position: relative;…
-
How to Get a JavaScript Stack Trace – Chrome Console
Hey everyone, Just a quick post on something useful I came across today. In JavaScript you can access the stack trace via console using the following command (ctrl + shift + j): console.trace() In Chrome, this will let you navigate to each relevant call by clicking the line number in the console window. I’ve found…
-
Chrome Replacing Strings with Ellipses – Chrome Console
Hey everyone, Ran into a bit of an issue today where a url was being shortened in Chrome’s console. It turns out that there’s a quick command you can use to copy the full value: copy(myVariable) Type copy into the console window and pass the variable you want to copy as a parameter. This will…
-
Sending Emails – MVC4 on GoDaddy
Hey everyone, Just a really basic model that can be used to send emails on GoDaddy in MVC4. The model: using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Web; using System.Net.Mail; using System.ComponentModel.DataAnnotations; namespace LL.Models { public class Email { [Key] public int EmailId { get; set; } public string From { get; set;…
-
Unable to add ‘Scripts/services/OrderService.js’ to the Web site. An unknown WinINet error has occurred (code 12113)
Hey everyone, I ran into the following error while trying to publish via FTP to GoDaddy using Visual Studio 2013: Unable to add ‘Scripts/services/OrderService.js’ to the Web site. An unknown WinINet error has occurred (code 12113) While I wasn’t able to work out an exact cause it seems to have been triggered by my alternative…
-
PayPal IPN Response Not Returning a pay_key Value
Hey everyone, In order to verify that a pay response is legitimate, PayPal provides a unique token for each request. This token can then be matched against payment confirmation requests to ensure that they aren’t being spoofed. The problem I ran into was that even the legitimate IPNs I received did not contain a pay…