asp net mvc in a web hosted world
Download
Skip this Video
Download Presentation
ASP MVC in A Web Hosted World

Loading in 2 Seconds...

play fullscreen
1 / 38

ASP MVC in A Web Hosted World - PowerPoint PPT Presentation


  • 557 Views
  • Uploaded 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 MVC in A Web Hosted World' - 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
jeff ammons
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
Agenda
  • Define Hosted Environment
  • Intro To MVC
  • Define Challenges
  • Explore Strategies
what is hosted environment
What Is Hosted Environment?
  • Web
  • Shared Server
  • Managed By Hosting Company
what s included
What’s Included?
  • Web Server
  • File Storage
  • Database
  • Bandwidth
  • Email
examples
Examples
  • GoDaddy
  • Hostgator
  • DiscountASP.net
  • Bizhostnet.com
data persistence options
Data Persistence Options
  • MySQL
  • SQL Server
  • File Based
    • XML
    • JSON
sql server
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
Who Is This Environment For?
  • Start-ups
  • Non-profit organizations
  • Personal use
why choose a hosted env
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
Challenges
  • Server Access
  • Server Options
  • Server Load
  • Dude, Where’s My Data?
  • Dude, Who Can See My Data?
microsoft vs foss the foss advantage
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
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
What is MVC?
  • Model
  • View
  • Controller
slide16
??
  • Design Pattern
  • Microsoft Web Framework
mvc pattern
MVC Pattern

Model

Data + Biz Rules

Controller

Middle Man/Traffic Cop

View

Presentation UI

asp net options
Asp.Net Options

SharePoint

WebForms

MVC

ASP.NET

mvc vs webforms
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
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
Demo Time
  • Hello, MVC World
  • jeffaBlogger
how do you get mvc to work in hosted env
How Do You Get MVC To Work In Hosted Env?
  • Request IIS 7
  • Publish Your Project
  • Include MVC DLL if necessary
strategies for success
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
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
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
Repository Model
  • Controller interacts with
    • Interface
    • Abstract Class
  • Different implementations
    • Entity Framework
    • Linq To Sql
    • Xml
    • Mock
linq to objects
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
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
Example LINQ Query

var orderedModuleList = from module in itemList.getList()

orderby module.Name

select module;

linq to lots of stuff
LINQ To Lots Of Stuff
  • LINQ To Entities
  • LINQ To SQL
  • LINQ To Objects
  • LINQ To XML
file system options
File System Options
  • POCO (Built-in .Net Serialization)
  • XML
why why why
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
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
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
Security
  • HTML Encode as much data as possible
    • Variety of Javascript attacks
  • Use AntiForgeryToken helper
goals for your project
Goals For Your Project
  • Website itself
  • Web app others can use
helpful links
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