Change my connectionstring for debug and release config

This is part of a multi page blog post where I talk about what I do after I setup my Visual Studio ASP.NET MVC (non-Core) project.

To go back to the previous posts or start at the beginning, please go to the links below:

  1. How I Setup my Visual Studio Website Project Asp.Net MVC (non-Core)

At this point I don’t like to use the LocalDb for my database but SKIP THIS STEP if you’re OK using the LocalDb provided.

In my Web.Config file, find the section which should be on top and change the entry from this:

    <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-vsStarterKit.mdf;Initial Catalog=aspnet-vsStarterKit-20170302095959;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

to this:

    <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(local);Initial Catalog=YOUR_DB;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

At the same time, I also change my Web.Release.config connection string to point to my live database when I publish.

On publish, it will swap the connection string so one less step.

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(local),1533;Initial Catalog=YOUR_DB_NAME;Persist Security Info=True;User ID=YOUR_LOGIN_ID;Password=YOUR_PWD;MultipleActiveResultSets=True" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
    <system.web>
        <compilation xdt:Transform="RemoveAttributes(debug)" />
    </system.web>
</configuration>

Step #3 – Coming Soon

Site for wicked cool Text Logos and it’s free

When I create new websites I’ll go with LogoNerds.com to get an initial logo completed and the cost is $27.

CapturFiles-Mar-12-2017_01.38.25

I do that because I can get as many revisions as I want for the first logo and it’s early on in the website process so if the site doesn’t work out I can dump it and it didn’t really cost me a lot of money.

HOWEVER

I just found a new site Textcraft which is a graphical text/logo generator that you use over the web. You can use it to make Minecraft, 8-bit and other styles of text.

It’s really slick so now I make a fun text logo for my new sites and if the site makes it thru all the testing and has some promise, I’ll move back to LogoNerds.com but for now Textcraft is very slick and free for now.

CapturFiles-Mar-12-2017_12.05.42

Which Flash Blocker to use and How to Disable Flash Blocker

It’s somewhat hypocritical of me to use a Flash Blocker I’ll admit especially since I have a website that depends on advertising i.e. my Diners, Drive-ins and Dives site with Guy Fieri on the Food Network (FlavortownUSA.com) but some of these sites are STILL USING FLASH and it’s downright annoying so I do use one.

WHICH ONE DO I USE?

I go with a new one called “Flash Block (Plus)” and I’m using it for Chrome. I don’t know if they have it for other browsers but they have it for Chrome and I highly recommend you use this browser.

CapturFiles-Mar-12-2017_10.17.55

The biggest reason I like it is for it’s simplicity and big notifications of the sections where it’s being blocked.

Other software in the past make it hard to block and keep the sections tiny so as an old man, it’s harder to see.

The other reason and it’s below is that they make it easy to white list sites and disable flash block so see the picture below.

HOW DO I DISABLE FLASH BLOCKER FOR SITES

Just click on the “+” sign to white list a site or disable Flash for sites you want to do this for. Very simple, super easy flash blocker that I am currently endorsing.

CapturFiles-Mar-12-2017_10_08_32

How I setup my Visual Studio website project ASP.NET MVC (non-Core)

This will be a long series of blog posts that will take you beyond the starter template provided by Visual Studio for making websites.

It’s easy to create a new website from the templates but these posts will take you beyond that as you need to add more to it in order to have a fully functional site with static pages for privacy policy, terms of service etc. along with having a robots.txt & sitemap.xml file.

These steps are what I use as my Starter Kit above and beyond what is provided in the templates.

I’m using the non-Core version for these posts but plan on creating a Core version that mimics the same steps.

I’m assuming that you already have Visual Studio loaded on your computer, if not please download a copy of Visual Studio here https://www.visualstudio.com.

Step #1: Create a new ASP.NET Web Application (.NET Framework) w/Individual User Accounts

  • Click File > New > Project in your Visual Studio app and you will see the screen below, make sure you select what I have highlighted in yellow and click the OK button.

vs-new-project

  • You will then move to the next screen, choose the Change Authentication button and make sure Individual User Accounts is selected then click the OK button and OK button again to create the project.

vs-new-project-individual-accounts

  • (optional) I like to see all of my files in the project and it’s just a quirk of mine but I like it so if you want to follow me, highlight the project and click Show All Files icons and you will see all of the hidden files and folders in your project.

vs-new-project-show-all-files

  • I like to update the NuGet packages at this point because these templates are always behind, once you do that, make sure to do a Clean Solution and Rebuild Solution after the Nuget packages are updated to make sure everything compiles properly.

vs-new-project-nuget-updates

Step #2: Change my connection strings