Install a clean Windows 8.1 install with a Windows 8 key

As you might already know you can update your windows 8 to windows 8.1 without the need of a new product key but you can’t install a clean windows 8.1 using windows 8 product key.

Well this is not entirely true and I will teach you how to do that.

The first thing you need to do is Create a Windows 8.1 Bootable USB device.

Next you will need to locate the folder sources inside your USB device with windows 8.1 installation. :\sources

Then create a new text document with the name ei.cfg

Enter the following content in ei.cfg:

[EditionID]
Professional
[Channel]
Retail
[VL]
0

Now boot your computer and start the windows 8.1 installation.
During the installation you will need to insert a product key. Use the your windows 8 product key.

Wait the installation to finish and you will have a clean windows 8.1 installation with a windows 8 product key.

Create a Windows 8.1 bootable USB device

In these days it’s very common that computers/laptops don’t have a optical drive. Because of this it’s no surprise that when you need to install Windows 8.1 you will need a USB device, such as a flash drive.
This was my case, I recently needed to installed Windows 8.1 and I didn’t have a optical drive. So I needed to find a way. In the next  steps I will teach you how to do that.

The first thing you need is a USB device, such as a flash drive.
The last thing you need is how to create a windows 8.1 bootable USB device.

The last part it’s easy thanks to the Windows Installation Media Creation Tool. This is the only tool you will need.

When you run the Windows Installation Media Creation Tool for the first time you will be presented with the following screen:

Windows-Installation-Media-Creation-Tool-1

In this screen you need to choose the language, the windows 8.1 edition and the architecture. Then click in the Next button.
In the next screen you need to choose that you want to save the installation file to the USB flash drive. Then click in the Next button.
If you want you can save it to an ISO and then burn the ISO to a optical drive such as a DVD.

Windows-Installation-Media-Creation-Tool-2

In the next screen you choose the USB flash drive. Then click in the Next button.

Windows-Installation-Media-Creation-Tool-3

In the last screen you need to wait the download and the creation of windows 8.1 bootable USB device.

Windows-Installation-Media-Creation-Tool-4

After this last step you will be ready to install windows 8.1.

Mvc DisplayAttribute Name based on resources

If you try to use resources in the property Name like this:

    public class ForgotViewModel
    {
        [Required]
        [Display(Name = Resources.Email)]
        public string Email { get; set; }
    }

You will get the error “An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type”

And this error is correct. So to use resources you will have to do something like this:

    public class ForgotViewModel
    {
        [Required]
        [Display(Name = "Email", ResourceType=typeof(Resources))]
        public string Email { get; set; }
    }

Now in your Resources type you will have to make sure that the Email property exists and that it’s Access Modifier is Public.

To may all Resources Public double click in your resx files and locate the drop box “Access Modifier” and change it’s value to Public.

 

Mvc5 EmailService implementation

This my generic EmailService Implementation. From here I can configure any email service like gmail.

public class EmailService : IIdentityMessageService
    {
        private const string ConfigurationEmailIsBodyHtml = "EmailIsBodyHtml";

        public static string From { get; set; }
        public static string UserName { get; set; }
        public static string Password { get; set; }
        public static string Host { get; set; }
        public static int Port { get; set; }
        public static bool EnableSsl { get; set; }
        public static bool IsBodyHtml { get; set; }
        public static bool UseDefaultCredentials { get; set; }
        public static SmtpDeliveryMethod DeliveryMethod { get; set; }

        static EmailService()
        {
            IsBodyHtml = ConfigurationManager.AppSettings[ConfigurationEmailIsBodyHtml].ToOrOther<bool>(true);

            SmtpSection section = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp");

            if (section != null)
            {
                From = section.From;
                Host = section.Network.Host;
                Port = section.Network.Port;
                EnableSsl = section.Network.EnableSsl;
                UserName = section.Network.UserName;
                Password = section.Network.Password;
                DeliveryMethod = section.DeliveryMethod;
                UseDefaultCredentials = section.Network.DefaultCredentials;
            }

        }

        public Task SendAsync(IdentityMessage message)
        {

            var smtp = new SmtpClient
            {
                Host = Host,
                Port = Port,
                EnableSsl = EnableSsl,
                DeliveryMethod = DeliveryMethod,
                UseDefaultCredentials = UseDefaultCredentials,
                Credentials = new NetworkCredential(UserName, Password)
            };

            using (var smtpMessage = new MailMessage(From, message.Destination))
            {
                smtpMessage.Subject = message.Subject;
                smtpMessage.Body = message.Body;
                smtpMessage.IsBodyHtml = IsBodyHtml;
                return smtp.SendMailAsync(smtpMessage);
            }

            // Plug in your email service here to send an email.
            //return Task.FromResult(0);
        }
    }

Gmail configuration:

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="username@gmail.com">
        <network host="smtp.gmail.com"
                 port="587"
                 enableSsl="true"
                 defaultCredentials="false"
                 userName="username@gmail.com"
                 password="password"/>
      </smtp>
    </mailSettings>
  </system.net>