ASP'net MVC in A Web Hosted World - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

ASP'net MVC in A Web Hosted World

Description:

15/month = Unlimited 200 MB DBs. Good basic set of ... Burn the heretic!!! SMALL datasets. Lots of Readers/Few Publishers. Blog. Informational site ... – PowerPoint PPT presentation

Number of Views:160
Avg rating:3.0/5.0
Slides: 39
Provided by: jef65
Category:
Tags: asp | mvc | heretic | hosted | net | web | world

less

Transcript and Presenter's Notes

Title: ASP'net MVC in A Web Hosted World


1
ASP.net MVC inA Web Hosted World
2
Jeff Ammons
  • The Atlanta Journal-Constitution
  • Developer/DBA
  • GGMUG.com
  • President
  • Gwinnett, Georgia, Microsoft User Group
  • 2nd Thursday, 630 PM Gwinnett Tech
  • Blog http//ammonsonline.com/jeffablog

3
Agenda
  • Define Hosted Environment
  • Intro To MVC
  • Define Challenges
  • Explore Strategies

4
What Is Hosted Environment?
  • Web
  • Shared Server
  • Managed By Hosting Company

5
Whats Included?
  • Web Server
  • File Storage
  • Database
  • Bandwidth
  • Email

6
Examples
  • GoDaddy
  • Hostgator
  • DiscountASP.net
  • Bizhostnet.com

7
Data Persistence Options
  • MySQL
  • SQL Server
  • File Based
  • XML
  • JSON

8
SQL Server
  • 15/month Unlimited 200 MB DBs
  • Good basic set of functionality
  • Choice of access methods
  • LINQ To SQL
  • Entity Framework
  • ADO
  • Etc.

9
SQL Server and MySQL
10
Who Is This Environment For?
  • Start-ups
  • Non-profit organizations
  • Personal use

11
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

12
Challenges
  • Server Access
  • Server Options
  • Server Load
  • Dude, Wheres My Data?
  • Dude, Who Can See My Data?

13
Microsoft vs FOSSThe 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

14
Microsoft vs FOSSThe 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

15
What is MVC?
  • Model
  • View
  • Controller

16
??
  • Design Pattern
  • Microsoft Web Framework

17
MVC Pattern
Model Data Biz Rules
Controller Middle Man/Traffic Cop
View Presentation UI
18
Asp.Net Options
SharePoint
WebForms
MVC
ASP.NET
19
MVC vs Webforms
  • 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
  • Dont 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?permalinkmy_story

20
Which To Choose?
  • MVC
  • Webforms
  • Internet Apps
  • UI is crucial
  • Attracting user is crucial
  • Users will leave if it doesnt look sexy
  • Internal IT apps
  • Developer time is crucial
  • Fill biz need is crucial
  • Users wont leave if it doesnt look sexy

None of these statements are absolutes!
21
Demo Time
  • Hello, MVC World
  • jeffaBlogger

22
How Do You Get MVC To Work In Hosted Env?
  • Request IIS 7
  • Publish Your Project
  • Include MVC DLL if necessary

23
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

24
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

25
Cache, Cache, Cache
  • Thanks to ASP.net plumbing
  • You just call it differently than webforms
  • Dont hit the database if you dont 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

26
Repository Model
  • Controller interacts with
  • Interface
  • Abstract Class
  • Different implementations
  • Entity Framework
  • Linq To Sql
  • Xml
  • Mock

27
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
    /

28
What Is LINQ?
  • Language INtegrated Query
  • SQL-like language construct for .Net
  • Joins
  • Tables
  • Objects
  • Both
  • Aggregation
  • Selection
  • Go to Jim Wooleys session next!

29
Example LINQ Query
  • var orderedModuleList from module in
    itemList.getList()
  • orderby
    module.Name
  • select module

30
LINQ To Lots Of Stuff
  • LINQ To Entities
  • LINQ To SQL
  • LINQ To Objects
  • LINQ To XML

31
File System Options
  • POCO (Built-in .Net Serialization)
  • XML

32
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

33
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

34
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

35
Security
  • HTML Encode as much data as possible
  • Variety of Javascript attacks
  • Use AntiForgeryToken helper

36
Demo Time
37
Goals For Your Project
  • Website itself
  • Web app others can use

38
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/
Write a Comment
User Comments (0)
About PowerShow.com