Thursday, November 27, 2014

install Chocolatey and resharper

open  command prompt with admin right

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin


open power shell with admin right

cint resharper

it will install 32 bit resharper

Mongodb MVC DLL install



 Install-Package mongocsharpdriver Tests

 Install-Package NUnit Tests

C# Coding standards using ReSharper

http://gojisoft.com/blog/2010/05/10/coding-standards-using-resharper/

http://rsm.codeplex.com/

Tuesday, November 25, 2014

MongoDB install - open command prompt with admin right


http://www.oodlestechnologies.com/blogs/Setting-up-MongoDB-with-Authentication-on-Windows

http://igorbicanic.blogspot.com/2014/11/install-and-configure-mongodb-replica.html?m=1

https://www.mongodb.org/dr//fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.6-signed.msi/download

http://docs.mongodb.org/ecosystem/platforms/windows-azure/

http://www.mongodb.com/presentations/hands-deploying-mongodb-azure?_ga=1.84217369.1486923176.1416959902


C:\Program Files\MongoDB 2.6 Standard\bin

command prompt has to start with admin right

create c:\data\db directory and run mongod.exe with admin right

mongod --install --replSet "MSWrs" --verbose -vvvvv --logpath c:/logs/mongo-server.log

mongod --install --replSet "MSWrs" --verbose -vvvvv --logpath c:/logs/mongo-server.log --slave


mongod.conf
dbpath=c:/data/db
logpath=c:/logs/mongo-server.log
verbose=vvvvv

C:\Program Files\MongoDB 2.6 Standard\bin

mongod -f c:\data\mongod.conf

install as a service

mongod -f c:\data\mongod.conf --install

mongo to start shell, then add user

add user to admin db
db = db.getSiblingDB('admin')
db.addUser( { user: "myUsername",pwd: "myPassword",roles: [ "userAdminAnyDatabase" ] } ) 

add user to another db
>use myDB
switched to db myDB
>db.addUser("myUsername","myPassword")

then remove service, then install again with --auth
mongod.exe --journal --config c:\data\mongod.conf --dbpath c:\data --auth --install

mongod --remove

mongod.exe --journal --config c:\data\mongod.conf --dbpath c:\data --auth --install --logpath=e:/data/mongo-server.log

mongod.exe --journal --config c:\data\mongod.conf --dbpath c:\data --auth --install

mongod --remove


services.msc

start mongodb

net start | findstr mongo

install on azure Linux box
winscp
putty

http://docs.mongodb.org/manual/core/document


1. Let us start with setting up the inbound rules, to do that click on Start and go to Administrative Settings and select Windows Firewall with Advanced Security as shown in the screen below.

f connected to the VM instance type the following command where port is 27018 for instance 1,27019 for instance 2 and 27020 for instance 3:

How to create login form/page and implement remember me next time checkbox in asp.net

http://www.webcodeexpert.com/2013/09/how-to-create-login-formpage-and.html

Monday, November 24, 2014

Where does code execution begin in an ASP.NET MVC app?






http://stackoverflow.com/questions/21882726/where-does-code-execution-begin-in-an-asp-net-mvc-app

You should have a default route defined in the route config cs file. Add a matching controller action and view. Put a break point in the action method. That and the global.asax methods would be the first point user code runs (baring any filters added)


The Global.asax.cx file, where there is the start method ``, might be what you are looking for. That is the code which is run when the app starts.
protected void Application_Start()
{
    ...
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    ...
}
But looking at the url you have posted it might be the HomeController or DirectoryController file. Unfortunately I cannot tell from looking at your route.
A sample route register code is as below where we can see that
  1. The URL /{controller}/{action}/{id}
  2. The default for controller/action/id is Home/Index/optional
So if you run your web with the starting url as http://localhost:52763/, it is indeed will call http://localhost:52763/Home/Index
public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}

Another example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace realEstate
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Rentals", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

Saturday, November 22, 2014

Single page application

http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2159

screencast building asp.net mvc forms with razor

http://blog.michaelckennedy.net/2012/01/20/building-asp-net-mvc-forms-with-razor/

http://blog.michaelckennedy.net/2012/01/23/screencast-building-asp-net-mvc-forms-with-razor/

https://www.youtube.com/watch?v=6VhqQngYQ20&list=PLwyG5wA5gIzhT6PJY6Zmfb8ariM9Um7VW

CheckBox Helper in MVC

http://www.vijayt.com/Post/CheckBox-Helper-in-MVC

http://www.dotnet-tricks.com/Tutorial/mvc/N50P050314-Understanding-HTML-Helpers-in-ASP.NET-MVC.html

http://saravananarumugam.wordpress.com/2012/04/02/working-with-mvc-3-razor-checkboxes/

Thursday, November 20, 2014

Wednesday, November 19, 2014

System.Web.WebPages version conflict

Error 5 Assembly 'System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.Helpers.dll MvcEnrollmentSystem


Since VS2010 installed or or express for web installed, I need to rename the two DLL to get it to compile and run



System.Web.WebPages.dll occurs twice

Error 4 The type 'System.Web.Mvc.ModelClientValidationRule' exists in both 'c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll' and 'c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll' E:\ASPNet\MvcEnrollmentSystem\MvcEnrollmentSystem\Models\AccountModels.cs 274 32 MvcEnrollmentSystem

Visual Studio 2010 trial download

http://stackoverflow.com/questions/8894654/vs-2010-trial-version-link

SP1
http://www.microsoft.com/en-us/download/confirmation.aspx?id=23691

Visual studio 2010 sp1 download

http://www.microsoft.com/en-us/download/confirmation.aspx?id=23691

Monday, November 17, 2014

Sunday, November 16, 2014

Saturday, November 15, 2014

Publish website to Azure from VS2013

When doing publish need to check setting to make sure SQL db ID and password is correct.

If error displaying data, go to VS2013 "SQL Server Object Explorer" check Configuration, especially the Connection String and you can change that if not correct.

Deleting a folder in TFS

http://stackoverflow.com/questions/2655505/deleting-a-folder-in-tfs

Deleting a folder in TFS is a little strange.
You have to:
  • Create a Workspace
  • Get the latest source for the folder (to your local machine)
  • Inside Source Explorer, delete the folder
  • Check in your changes (this is the step that deletes the folder in Source Control)

Friday, November 14, 2014

Asp.net Google form

http://www.gilgh.com/article/send-data-to-a-google-form-using-asp-net,-c

Tuesday, November 11, 2014

Entity Framework Power Tools Beta 4

https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

Using EF “Code First” with an Existing Database

http://weblogs.asp.net/scottgu/using-ef-code-first-with-an-existing-database

https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

The model backing the 'ApplicationDbContext' context has changed

Server Error in '/' Application.

The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

Source Error:


Line 156:            {
Line 157:                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
Line 158:                var result = await UserManager.CreateAsync(user, model.Password);
Line 159:                if (result.Succeeded)
Line 160:                {

Tuesday, November 4, 2014

Insert video into your presentation

http://office.microsoft.com/en-us/powerpoint-help/link-to-a-video-2-20-RZ102673174.aspx?section=4