Asp net mvc in a web hosted world
Download
1 / 38

asp.net mvc in - PowerPoint PPT Presentation


  • 553 Views
  • Updated On :

ASP.net MVC in A Web Hosted World. Jeff Ammons. The Atlanta Journal-Constitution Developer/DBA GGMUG.com President Gwinnett, Georgia, Microsoft User Group 2 nd Thursday, 6:30 PM Gwinnett Tech Blog: http://ammonsonline.com/jeffablog. Agenda. Define Hosted Environment Intro To MVC

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'asp.net mvc in' - erika


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Asp net mvc in a web hosted world l.jpg

ASP.net MVC inA Web Hosted World


Jeff ammons l.jpg
Jeff Ammons

  • The Atlanta Journal-Constitution

    • Developer/DBA

  • GGMUG.com

    • President

    • Gwinnett, Georgia, Microsoft User Group

    • 2nd Thursday, 6:30 PM Gwinnett Tech

  • Blog: http://ammonsonline.com/jeffablog


Agenda l.jpg
Agenda

  • Define Hosted Environment

  • Intro To MVC

  • Define Challenges

  • Explore Strategies


What is hosted environment l.jpg
What Is Hosted Environment?

  • Web

  • Shared Server

  • Managed By Hosting Company


What s included l.jpg
What’s Included?

  • Web Server

  • File Storage

  • Database

  • Bandwidth

  • Email


Examples l.jpg
Examples

  • GoDaddy

  • Hostgator

  • DiscountASP.net

  • Bizhostnet.com


Data persistence options l.jpg
Data Persistence Options

  • MySQL

  • SQL Server

  • File Based

    • XML

    • JSON


Sql server l.jpg
SQL Server

  • $15/month = Unlimited 200 MB DBs

  • Good basic set of functionality

  • Choice of access methods

    • LINQ To SQL

    • Entity Framework

    • ADO

    • Etc.



Who is this environment for l.jpg
Who Is This Environment For?

  • Start-ups

  • Non-profit organizations

  • Personal use


Why choose a hosted env l.jpg
Why Choose A Hosted Env?

  • Lost cost ($5-$20/month)

  • Quick Start

  • Fewer People Required

  • No hardware to buy

  • No hardware to maintain

  • No server room


Challenges l.jpg
Challenges

  • Server Access

  • Server Options

  • Server Load

  • Dude, Where’s My Data?

  • Dude, Who Can See My Data?


Microsoft vs foss the foss advantage l.jpg
Microsoft vs FOSS:The FOSS Advantage

  • Lots of FOSS based sites (LAMP)

  • Lots of FOSS sample code

  • Zero start-up cost

  • MS stack seen as ugly and corporate-looking


Microsoft vs foss the empire strikes back l.jpg
Microsoft vs FOSS:The Empire Strikes Back

  • Asp.Net MVC

  • JQuery supported

  • OFFICIALLY

  • Visual Studio

  • Express Edition

  • BizSpark

  • WebsiteSpark

  • You CAN achieve zero start-up cost

  • You CAN make good looking sites


What is mvc l.jpg
What is MVC?

  • Model

  • View

  • Controller


Slide16 l.jpg
??

  • Design Pattern

  • Microsoft Web Framework


Mvc pattern l.jpg
MVC Pattern

Model

Data + Biz Rules

Controller

Middle Man/Traffic Cop

View

Presentation UI


Asp net options l.jpg
Asp.Net Options

SharePoint

WebForms

MVC

ASP.NET


Mvc vs webforms l.jpg
MVC vsWebforms

MVC

Webforms

  • No controls

  • Full control of emitted HTML

  • Clean HTML emitted

  • Might take longer but you have total control of look and feel

  • Separation of Concerns

    • Easier for tests, TDD

  • Clean URLs

    • www.myblog.com/my_story

  • Lot of controls

  • Don’t need to do so much HTML

  • Viewstate makes HTML lovers cry

  • Quick but often “looks like Microsoft Website”

  • More tightly coupled

  • Not so clean URLs

    • www.myblog.com/blog.aspx?permalink=my_story


Which to choose l.jpg
Which To Choose?

MVC

Webforms

  • Internet Apps

    • UI is crucial

    • Attracting user is crucial

    • Users will leave if it doesn’t look sexy

  • Internal IT apps

    • Developer time is crucial

    • Fill biz need is crucial

    • Users won’t leave if it doesn’t look sexy

None of these statements are absolutes!


Demo time l.jpg
Demo Time

  • Hello, MVC World

  • jeffaBlogger


How do you get mvc to work in hosted env l.jpg
How Do You Get MVC To Work In Hosted Env?

  • Request IIS 7

  • Publish Your Project

  • Include MVC DLL if necessary


Strategies for success l.jpg
Strategies For Success

  • ActionLink Sucks At Virtual Directories

    • www.mydomain.com

    • www.mydomain2.com

    • /root  mydomain.com

    • /root/mydomain2  mydomain2.com

    • www.mydomain2.com/mydomain2/my_story


Actionlinkv l.jpg
ActionLinkV

  • You can replace darned near anything in MVC

  • The source is Open

  • ActionLinkV replaces ActionLink

  • Add Helpers Directory

  • Add files to Helpers

  • Register in web.config


Cache cache cache l.jpg
Cache, Cache, Cache

  • Thanks to ASP.net plumbing

    • You just call it differently than webforms

  • Don’t hit the database if you don’t need to

  • Set in the CONTROLLER

    • Set for entire controller

    • Set for individual methods

  • Do NOT cache personal info!

  • Options

    • Set cache location

    • Vary by param


Repository model l.jpg
Repository Model

  • Controller interacts with

    • Interface

    • Abstract Class

  • Different implementations

    • Entity Framework

    • Linq To Sql

    • Xml

    • Mock


Linq to objects l.jpg
Linq To Objects

  • For small datasets

  • Query collections of objects

  • Use object serialization to save to disk

  • What it wants to be when it grows up

    • http://research.microsoft.com/en-us/projects/dryad/


What is linq l.jpg
What Is LINQ?

  • Language INtegrated Query

  • SQL-like language construct for .Net

    • Joins

      • Tables

      • Objects

      • Both

    • Aggregation

    • Selection

  • Go to Jim Wooley’s session next!


Example linq query l.jpg
Example LINQ Query

var orderedModuleList = from module in itemList.getList()

orderby module.Name

select module;


Linq to lots of stuff l.jpg
LINQ To Lots Of Stuff

  • LINQ To Entities

  • LINQ To SQL

  • LINQ To Objects

  • LINQ To XML


File system options l.jpg
File System Options

  • POCO (Built-in .Net Serialization)

  • XML


Why why why l.jpg
Why? Why? Why?

  • Not ALL apps (or portions of apps) need relational databases

    • Burn the heretic!!!

  • SMALL datasets

  • Lots of Readers/Few Publishers

    • Blog

    • Informational site

    • Personal site

  • Excessive DB Traffic


Example l.jpg
Example

  • Custom ASP.Net Membership Provider

  • Basic log-on info

  • Works great with 10-30,000 users

  • Total DOG with 500,000 users

  • No calls to DB server

  • Most start-ups would KILL to get 10,000 users


Css themes l.jpg
CSS Themes

  • Standards Compliant

  • http://www.freecsstemplates.org/

  • Create base class for your controllers

  • Put link into ViewData

    • Since it is in the base of all your controllers, all controllers will pass it to the views


Security l.jpg
Security

  • HTML Encode as much data as possible

    • Variety of Javascript attacks

  • Use AntiForgeryToken helper



Goals for your project l.jpg
Goals For Your Project

  • Website itself

  • Web app others can use


Helpful links l.jpg
Helpful Links

  • MVC

    • http://www.asp.net/mVC/

  • Blogs

    • http://weblogs.asp.net/Scottgu/

    • http://haacked.com

    • http://www.hanselminutes.com/

  • Sites

    • http://www.nerddinner.com/

    • http://stackoverflow.com/


ad