ASP.NET MVC ActionFilters and Response.Redirect

Posted by Jason on December 19, 2008 at 5:28 pm

There is an issue with using the following code in an action filter:

filterContext.HttpContext.Response.Redirect(loginUrl, true);

which is a bit of code quite common in an authentication filter. The problem is it will throw a ThreadAbortException as soon as you put your code on a live site resulting in the error page for anyone who is not logged in. This is probably not what you want since you are attempting to redirect them to the login page.

Now it is a little unfair to say that it’s an issue because that is the intended functionality. But it doesn’t fit well with MVC controllers, especially since Microsoft’s official suggestion is to set the endResponse flag to false. That is just downright misleading since your controller action (which the filter just decided you can’t access) is still executed after the filter fails authentication - resulting in the action code being executed anyway whilst you see the login screen on the browser and assume it all went swimmingly! Meanwhile those files that this user shouldn’t have access to got deleted.

Yeah, that’s what I just did during testing whilst proving to myself that you can’t fake the URL as a non-registered user. Imagine my surprise. It’s true that the chances of a malicious user actually working out the URL might be low, but that’s no reason to leave the door open.

Oh, and your unit tests probably won’t catch this because the filters don’t get executed by the unit tests. But I digress…

To cut a long story short, this bit of code in your base controller (assuming you have one, otherwise stick in in all of the controllers) will prevent the issue:

        protected override void OnException(ExceptionContext filterContext)        {            if (filterContext.Exception is ThreadAbortException)            {                filterContext.ExceptionHandled = true;            }        }

Canadian Pharmacy Cheap Viagra
Viagra Over The Counter
Combine Viagra And Cialis
Cialis Off Shore
Viagra Balls
Buy Softtabs Cialis
Cheap Viagra Direct
Cialis For Woman
Viagra Cheap Less
Viagra Women Effects
Free Sample Pack Of Viagra
Cialis Tadalfil
Viagra India
2cialis Levitra Viagra Vs Vs
Cialis And Levitra
Cialis And The Prostate
Die Entdeckung Von Viagra
Natural Viagra Alternatives
Generic Viagra Sample
Cialis Cialis Drug Generic Levitra
Herbal Shopping Viagra
Viagra Online Huge Discounts
Buy Viagra Online 35008
Viagra By The Pill
Hugh Heffner On Viagra
Cialis Effects Information
Drug Generic Viagra
Cialis Duration Of Effectiveness
Viagra For Women 2005
Online Ed Drugs Viagra Samples Package
International Internet Viagra
Viagra Vs Levitra Vs
Dr Herbst Dercum S Viagra
Success Of Viagra
Viagra Treat Childhood Pulmonary Hypertension
Cb Viagra Kit
Canadian Pharmacy For Cialis
Cialis Generic Pharmacy Online
Cialis Levitra Better
Prednisone Cialis Combine
Sublingual Viagra
Generic Viagra X Mg
Deal Herbal Viagra
Generic Viagra Louisville Ky
Viagra Mail Order Uk
Tadalafil Generic Cialis
Nature’s Viagra
Cialis Experience
Cialis Advertisement
Discout Cialis
Foreign Pharmacy Viagra
Cialis Usage For Recreational Sex
Viagra Patent Expiration Date
Medicare Viagra 2006
Kwiktabs Meltabs Generic Viagra About
Cheap Online Prescription Ultram Viagra Zoloft
Cod Generic Pal Pay Viagra
Metformin Viagra Interaction
Drug Generic Generic Viagra
Cheap Pill Viagra
Generic Cialis Mg Amp Mg
Vergelijking Cialis Kamagra
Viagra Calgary
When Do You Need Viagra
Buying Viagra Online
Cialis Tadalafil 20 Mg
Cheapest Generic Substitute Viagra
Cheap Online Pharmacy Viagra Viagra
Yohimbe And Viagra
Cialis Preisvergleich
Overnight Cialis Soft
Phisher Viagra
Viagra Testimonies
Viagra Pill Picture
Does Medicare Cover Viagra
Can Viagra Help A Women Conceive
Cialis Pills And Commercial
Female Viagra Alternative
Cheap Overnight Viagra
Clinical Data For Large Dosage Cialis
Compare Generic Viagra Wholesale Prices
Nitrix Interaction With Cialis
Mechanism Of Viagra
Viagra Sample Overnight Delivery
Celebrity Endorsments Viagra
Cialis Lowest Price
Viagra Cilias Comparison
Viagra Versus Birth Control
Cialis Safe Secure Online Shopping
Free Prescription Viagra
Cialis Generic Lowest Price
Fraudulent Viagra
Charles Linskaill Find Viagra Free
Viagra Semenax Vigrx Reviewed At Dethroner
Cialis Generic Discount
Herbal Cialis
Viagra From Canada Legitimate Msnbc
Viagra Frozen Embryo Transfer
Cialis And Online Prescription
Viagra Helps Conception
Viagra Falls Band
Buy Viagra Powered By Phpbb
Cialis Online Sale
Buy Viagra Overnight
6viagra Propecia
Viagra Sa
Best Price For Generic Viagra
Viagra Onoine Without Prescroption
Free Buy Cialis Softtabs
Viagra Financials
1 Cialis Tadalafil Jpg
Cheapest Viagra Substitut
John Bouchie Viagra
Insurance Viagra Health Coverage
Viagra Damage After 4 Hours
What Are Side Effects Off Viagra
Herbal Alternative Viagra Levitra Herb
It’s Like Haha Powdered Viagra
Cheap Viagra 25mg
Compare Enzyte And Viagra
Funny Viagra
Mail Order Viagra Without Prescription
Viagra And High Blood Pressure
Fox Buisness Female Viagra
James Thompson Viagra Lawsuit
Site Ebaycouk Kamagra Viagra Sildenafil
Is Viagra Safe For Woman
Can I Make Generic Viagra
Silagra Generic Viagra Cumwithuscom
Cheapest Viagra World
Discount Viagra 50 Mg
Like Pill Viagra
Information About Viagra
Can Atenolol Be Taken With Viagra
Compare Generic Viagra To Viagra
Viagra Prescribing Info
Cialis Personal Review
Cialis Britain
Viagra Package Quantity
Cialis Soft
Bean Jumping Mexican Viagra
Wikipedia Cialis
Id 1321 Cialis
Free Trial Cialis
Liquid Viagra Shot Recipe
Canada Buy Cialis Online
Cialis Marketing Strategy
Cialis Bestseller
Cialis Generic Overnight
Free Viagra Sample Online
Cheap Phizer Viagra
Viagra Safe For Dogs
Cialis Discount India
Generic For Cialis
Viagra Tips
Viagra Extended Use
Take Viagra And Cialis
Viagra Class Action
Cialis Shipping
Become Does Drug Overdosing Viagra
Viagra Free Sites Results Find Computer
Jean Coutu Bio Viagra
Cuba Gooding Jr Cialis Video
Cialis Pills Wholesale
Buy Cialis Online Cheap
Brand Viagra
Cialis In Dublin
Free Sites Computer Search Viagra Buy
2003 Cialis Levitra Market Sales Viagra
Best Price On Cialis
Viagra And Headaches
Cheep Viagra From Inda
Cheap Viagra Overnight Delivery
Irish Viagra Drink
Buy Tadalafil Cialis
Viagra Question
Multiple Erections Viagra
Buy Online Prescription Vaniqa Viagra
Red Pill Viagra
Semen Turns Yellow Viagra Bought Online
1cheap Generic Cialis
Viagra Flushing
Price Of Cialis
Recommended Doasage Cialis
Canada Online Pharmacy Viagra Indeks
Viagra In The Water Blondes
Viagra Uk Sites
Kamagra Generic Viagra 100 Mg Sildenafil
Viagra Use Women
Quality Of Generic Viagra
Uk Cialis
Uprima Viagra Cialis
Cialis Britan
Buy Cheap P Viagra
Cialys Viagra Mechanics
Viagra Gif
After Viagra
Viagra Blue Pill
Viagra G N Rique D’ordre
Buy Pharmacy Pill Viagra
Online Cialis Sale
Best Retail Pharmacy Viagra Price
Cialis Discount Generic
Generic Viagra Buy Online
Cialis Does It Work
Soft Cialis Mastercard
Viagra Sales In Uk
Prescription For The Real Authentic Viagra
Online Prescriber Of Viagra
Estate Sale Viagra
Free Online Viagra Pill Sample
Viagra Cholesteral
Tadafil Cialis On-line Pharmacies
Viagra Express
Purchasing Viagra Australia
Calias Viagra
Cialis Prescription Drug Stores Yasmin
Cialis Generique Achat
Cry Thou Blessing Cialis Cty
Kamagra Viagra Silden
Can Viagra Be Taken With Norvasc
Viagra Istambul
Generic Viagra Listings
Viagra Free Pills
Viagra Cheap Generic
Pleasure Cheap Viagra
Cheaper Viagra
Viagra Best Prices Fda Approved Online
Fed Ex Delivert Cialis
Viagra 100mg Free Shipping
Bye Viagra
Doesnt Viagra Work
Icos Cialis
Viagra Falls Band South Bend
Discount Keyword Viagra
1cheap Cialis Online
Tadafil Cialis
Ubat Kuat Cialis
Compare Zenerx With Viagra
Cheap Deal Deal Pill Viagra
Male Enhancement Cialis
Viagra Dreampharm
Seduced With Viagra
Dali Viagra
Otc Viagra For Valentines Day
Viagra Epi
Never Mix Beer And Viagra Picture
Cialis Levitra Strong Viagra
Does Cialis Delay Ejaculation
Buy Viagra Search Find Free
Impotence Picture Pill Viagra
Viagra Sverige
Viagra Fedex
Cialis Dosage Instructions
Mitral Valve Prolapse Viagra
Order Generic Cialis C O D
Boots Sell Viagra
Medical Prescription Viagra
Cialis Generic Brand Name Differences
Liver Disease Viagra
Black Market Viagra Alert
Dose Of Viagra
Viagra Cailis
Edinburgh Girl Manson Pages Viagra Boring
Gloria Viagra
Xanax Viagra Diazepam
Viagra And Addiction
Cialis Viagra Levitra Which Is Best
Cialis Ads
Generic Viagra Pills
Viagra 50mg Soft Tab Generic
Nitric Oxide Viagra Enzyme Blocker
Viagra Cialis Buy No Prescription
Hollywood Cialis
4.40 Buy Online Viagra
Viagra Seldenifil Citrate
Viagra Sales 2004
Recent Referers Viagra
Nhs Prices Viagra Uk
Dose Viagra
Side Affects Viagra
Amazing Blonde Fucked Cialis
Viagra Generic Soft Tabs 100mg
Compare Genaric Cialis Prices
Drugs To Use With Viagra
Cialis Memory Foam Mattresses
Cialis Soft Tabs Online Pharmacy
Viagra Long Term
Viagra From Uk
Hamsters Viagra
Charlotte Wells Viagra
Buy Canada Viagra
Buy Viagra Meds Online
Generic Viagra Cialis
Viagra Generic Sildenafil
Canada Cialis Generic
Cialis Doesnt Work
Viagra Oral Jelly
Personal Experience Viagra
Does Cialis Help Premature Ejaculation

Maximum Request Length Exceeded

Posted by Jason on December 11, 2008 at 9:52 am

It’s hard to believe how badly this is handled in IIS. Admittedly I’ve only tried it in IIS 6, but I see no evidence that it gets any better in IIS 7.

So here’s the problem - you create a website that allows the upload of images (or any file types for that matter). It’s very likely you’re going to want to limit the size of those uploads or you’ll end up in a world of pain when your users go and use up all your disk space. By default IIS allows upload sizes of 4Mb which is ample for image purposes. However, if someone uploads a file above that size you’re likely to want to notify them by telling them gently they’re an idiot for not reading the note above the file input field and then allow them to reselect a file.

But you can’t because the requests never gets to your page. IIS simply drops the request and seems to respond with nothing at all. That leaves the user looking at a ‘Web site could not be found’ error, which is misleading and just plain wrong.Famvir
Purchase Mentat
Purchase Diarex
Cheap Mevacor
Order Prograf
Buy Oxycontin
Sinequan
Order Celebrex
Buy Pilex
Cheap Cozaar
Order Cordarone
Purchase Imitrex
Purchase Diflucan
Buy Pamelor
Purinethol
Order Levitra
Keftab
Cheap Norvasc
Purchase Carisoprodol
Cheap Evecare
Purchase Mycelex-G
Purchase Avapro
Order Clomid
Depakote
Purchase Aceon
Buy Himplasia
Buy Cytotec
Purchase Clomid
Seroquel
Cheap Bupropion
Parlodel
Cheap Zyban
Cheap Diabecon
Cheap Femara
Differin
Combivent
Order Lamisil
Lasuna
Chitosan
Buy Accupril
Avandamet
Himcolin
Danazol
Cheap Prograf
Men Attracting
Purchase Pamelor
Order Himcolin
Order Lotensin
Buy Ophthacare
Prevacid
Zetia
Starlix
Order Levlen
Buy Septilin
Purchase Prevacid
Reosto
Flexeril
Cheap Serophene
Order Vantin
Lozol
Buy Brahmi
Buy Aristocort
Pletal
Purchase Tramadol
Cheap Isordil
Acne-n-Pimple Cream
Cheap Zebeta
Order Penisole
Order Inderal
Avandia
Order Stromectol
Requip
Buy Lynoral
Watson
Speman
Rhinocort
Ultram
Buy Fosamax
Buying Phentermine
Buy Koflet
Buy Triphala
Diet Maxx
Buy Serophene
Purchase Prednisone
Buy Levothroid
Order Diarex
Buy Differin
Buy Casodex
Purchase Zovirax
Order Fastin
Purchase Hytrin
Cheap Ansaid
Cheap Endep
Cheap Propecia
Mycelex-G
Ambien
Order Clarinex
Buy Glucophage
Himplasia
Purchase Sustiva
Shuddha Guggulu
Cheap Elimite
Order Herbolax
Clarina
Purchase Brafix
Cheap Acticin
Buy Viagra
Purchase Renalka
Order Clarina
Cheap Bactroban
Buy Lortab
Adalat
Brahmi
Buy Darvocet
Purchase Buspar
Purchase Effexor
Order Pravachol
Purchase Micardis
Cheap Levitra
Cheap Trandate
Buy Norco
Orgasm Enhancer
Avapro
Cheap Zyvox
Cheap Accupril
Cheapest Adipex
Buy Antabuse
Order Flovent
Buy Zyprexa
Purchase Brahmi
Order Propecia
Vitamin A
Buy Emsam
Hytrin
Cheap Lasix
Cheap Sumycin
Cheap Prevacid
Buy Carisoprodol
Buy Menosan
Premium Diet
Buy Effects
Order Feldene
Cheap Combivent
Purchase Nolvadex
Pamelor
Purchase Premarin
Order Viramune
Cheap Avandamet
Buy Revia
Cheap Prandin
Menopause Gum
Purchase Imdur
Cheap Butalbital
Cheap AyurSlim
Cheap Avandia
Purchase Ansaid
Tramadol
Buy Zocor
Purchase Sildenafil
Augmentin
Buy Lorazepam
Order Overnight
Cheap Koflet
Order Diovan
Buy Pletal
Buy Herbolax
Order Himcospaz
Order Isordil
Order Neurontin
Buy Risperdal
Purchase Lamictal
Geodon
Order Lasix
Cheap Himcocid
Order Lopressor
Yerba Diet
Cheap Rumalaya
Zero Nicotine
Order Geriforte
Buy Adipex
Zerit
Order Himplasia
Order Atacand
Cheap Zimulti
Cheap Adalat
Buy Clomid
Cheap Arimidex
Buy Augmentin
Buy Brite
Buy Adalat
Levlen
Order Elimite
Cheap Mobic
Purchase Watson
Purchase Ashwagandha
Order Cozaar
Purchase Styplon
Purchase Levlen
Order Zanaflex
Buy Nizoral
Order Sinequan
Cheap Acyclovir
Cheap Lorazepam
Serevent
Purchase Requip
Purchase Shoot
Effexor
Buy Trandate
Purchase Omnicef
Purchase Retin-A
Purchase Himplasia
Viagra
Buy Mobic
Buy Nimotop
Vasotec
Order Seroquel
Buy Geriforte
Buy Starlix
Order Flomax
Nizoral
Purchase Xanax
Purchase Feldene
Order Calan
Order Carisoprodol
Order Kamagra
Buy Consultation
Order Flonase
Buy Phentrimine
Cheap Shallaki
Cheap Cardura
Buy Urispas
Methocarbam
Buy Sorbitrate
Buy Gasex
Cheapest Generic
Cheap Vasotec
Purchase Hydrocodone
Order Hytrin
Lynoral
Order Loprox
Order Ansaid
Buy Plendil
Purchase Confido
Purchase Zocor
Cheap Diazepam
Buy Hytrin
Purchase Serevent
Buy Requip
Purchase Brite
Buy Micardis
Buy Viramune
Acticin
Buy Fioricet
Buy CLA
Buy Ultram
Gyne-Lotrimin
Order Trazodone
Karela
Loprox
Buy Nonoxinol
Cytotec
Cardura
Buy Zovirax
Order Evista
Buy Clonazepam
Purchase Lynoral
Purchase Atarax
Proventil
Purchase Cystone
Purchase Bupropion
Buy Vicodin
Cheap Nolvadex
Buy Protonix
Buy Meridia
Buy Trimox
Shallaki
Buy Flonase
Order Adalat
Ansaid
Abana
Ephedrine
Buy Ephedrine
Clomid
Buy Mentat
Buy Cordarone
Order Actos
Sorbitrate
Purchase Acticin
Viagra Jelly
Buspar
Purchase Clarina
Buy Capoten
Purchase Aricept
Tentex Forte
Purchase Capoten
Cheap Protonix
Purchase Avandamet
Purchase Glucophage
Cheap Antabuse
Purchase Zimulti
(more…)

Creating Strongly-Typed Views in ASP.NET MVC Beta

Posted by Jason on December 5, 2008 at 12:42 pm

One of the big problems with the early adoption of any framework is the documentation. No books are released yet, if they are ever going to be, and so turning to Google is your best bet. In fact it’s your only option and my own preference is using Google over books anyway.

But frameworks change during development and you come across the issue that all of the top hits for your query are based on previous versions. When that previous version did it differently you’re stuck! I had this problem today when trying to create strongly-typed views. I love strongly-typed anythings, but I’m just a sucker for having a project that is more likely to work when another developer makes an edit and doesn’t bother fully checking the effects of their changes. It’s another safety net, and I’m a sucker for safety nets as well.

So, this is how I did it in bite-sized chunks. First the controller function:

public ActionResult Index()
{
var ContentObject = new ContentClass()
return View(ContentModel.Load(ContentObject));
}

Next I created a new view by right-clicking the above method (bear in mind that I’m using Visual Studio 2008) and checking the ‘Create a strongly-typed view’ before entering the full name of the object type (ContentClass). That produces an aspx.cs which looks something like this:

public partial class Index : ViewPage<ContentClass>

So far so good, but where I really came unstuck was actually using this in the view. Turns out it’s simpler than ever. All you need to use is the ViewData.Model parameter, which is automatically typed to whatever you set the view up as previously:

<%
  foreach (var portfolio in ViewData.Model.Portfolios)
  {
%>
  <p><%= portfolio.ID %></p>
<%
  }
%>

All that I have to do now is pass that through to a UserControl. I’m assuming I can strongly-type those as well. We shall see.

Speman
Purchase Omnicef
Cheap Darvocet
Buy Proventil
Order Endep
Purchase Motrin
Diabecon
Purchase Lexapro
Purchase Loxitane
Order Proscar
Cheap Coreg
Purchase Zyvox
Men Attracting
Order Serophene
Purchase Zanaflex
Order Ambien
Nonoxinol
Purchase Aleve
Order Ventolin
Order Nimotop
Cheap Cordarone
Purchase Feldene
Cheap Cardura
Buy Copegus
Order Plavix
Cheap Famvir
Buy Effexor
Buy Elavil
Buy Ionamin
Purchase Topamax
Buy Zerit
Order Imdur
Aceon
Order Styplon
Order Quibron-T
Buy Avodart
Purchase Adipex
Cheap Nizoral
Buy Norco
Order Famvir
Purchase Clomid
Order Tramadol
Zero Nicotine
Purchase Hydrocodone
Buy Plan
Purchase Trimox
Cheap Zanaflex
Cheap Rogaine
Purchase Ophthacare
Purchase Diarex
Zyrtec
Buy Quibron-T
Order Copegus
Buy Lukol
Purchase Mentax
Cheap Nirdosh
Buy Levaquin
Buy Lanoxin
Buy Speman
Purchase Aricept
Purchase Oxycontin
Order Sarafem
Cheapest Adipex
Purchase Septilin
Lisinopril
Buy Loxitane
Order Augmentin
Cheap Lanoxin
Acyclovir
Cheap Exelon
Purchase Ambien
Purchase Brahmi
Mental Booster
Purchase Allegra
Order Oxycontin
Purchase Levlen
Cheap Tricor
Lexapro
Purchase Capoten
Order Tenuate
Order Speman
Zantac
Purchase Penisole
Purchase Buspar
Order Motrin
Hair Loss
Order Lanoxin
Order Prograf
Buy Acyclovir
Order Capoten
Cheap Flonase
Purchase V-Gel
Purchase Adalat
Purchase Differin
Order Pravachol
Sustiva
Amoxil
Cheap Accutane
Cheap Cystone
Cheap Zyloprim
Cardizem
Buy Cozaar
Purchase Karela
Buy Abana
Buy Renalka
Order Bupropion
Buy Cordarone
Buy Aricept
Purchase Starlix
Buy Lasuna
Buy Darvocet
Buy Fosamax
Order Revia
Order Xeloda
Coreg
Cheap Danazol
Order Overnight
Order Lasuna
Purchase Lamictal
Order Procardia
Buy Sinequan
Paxil
Arava
Buy Ambien
Buy Danazol
Cheap Imdur
Purchase Zyrtec
Order Bonnisan
Buy Purim
Buying Phentermine
Cheap Hyzaar
Purchase Nirdosh
Buy Prandin
Rimonabant
Cheap Diazepam
Cheap Deltasone
Menopause Gum
Purchase Actos
Buy Neurontin
Flonase
Cheap Plendil
Purchase Evista
Combivent
Buy Confido
Karela
Order Tenormin
Purchase Reosto
Glucotrol XL
Purchase Butalbital
Order Zimulti
Norvasc
Order Hytrin
Cheap Cephalexin
Purchase Copegus
Order Zyprexa
Purchase Abana
Order Rogaine
Buy Altace
Zyvox
Buy Relafen
Cheap Celebrex
Tramadol
Order Mobic
Order Himplasia
Cheap Sarafem
Buy Plavix
Brahmi
Brafix
Buy Nonoxinol
Order Levlen
Female Sexual
Cheap Protonix
Cheap Lamictal
Order Keftab
Buy Synthroid
Purchase Prilosec
Order Zetia
Cheap Levaquin
Order Eurax
Order Atarax
Order AyurSlim
Order Flexeril
Cheap Tenuates
Purchase Diabecon
Purchase Didronel
Motrin
Purchase Lozol
Cheap Purinethol
Cheap Xanax
Purchase Sinequan
Cheap Mycelex-G
Order Valium
Order Combivent
Cheap Revia
Purchase High
Order Arava
Pamelor
Purchase Endep
Nolvadex
Imdur
Buy Lexapro
Cheap Mentat
Geriforte
Buy Nirdosh
Order Darvocet
Cheap Propecia
Cheap Didronel
Purchase Mycelex-G
Order Avandia
Cheap Amaryl
Cheap Effexor
Rythmol SR
Buy Zyvox
Purchase Zithromax
Butalbital
Prograf
Order Arimidex
Purchase Acyclovir
Order Lamisil
Buy Micardis
Cyklokapron
Buy Noroxin
Order Geodon
Relafen
Purchase Adderall
Cheap Cytotec
Purchase Serophene
Buy Karela
Purchase Leukeran
Buy Bupropion
Order Lexapro
Cheap Brafix
ActoPlus Met
Order Protonix
Order Inderal
Purchase Elimite
Buy Flomax
Order Kytril
V-Gel
Order Casodex
Purchase Proventil
Procardia
Buy Codeine
Cheap Cozaar
Purchase Renalka
Myambutol
Cheap Naprosyn
Order Retin-A
Buy Himcocid
Order StretchNil
Order Diazepam
Purchase Serevent
Buy Carisoprodol
CLA
Buy Zyban
Xanax
Cheap Xenacore
Buy Premarin
Purchase Rumalaya
Aciphex
Order Lincocin
Mentax
Purchase Elavil
Ultram
Purchase CLA
Purchase Vasotec
Cheap Elavil
Order Lopid
Cheap Loprox
Diarex
Order Meridia
Purchase Cipro
Order Lozol
Purchase Rocaltrol
Order Isoptin
Order Avandamet
Purchase Exelon
Buy Omnicef
Buy Acomplia
Purchase Herbolax
Cheap Fioricet
Alprazolam
Order Fioricet
Noroxin
Ephedrine
Buy Prinivil
Purchase Amaryl
Order Mysoline
Cheap Nolvadex
Buy Adalat
Cheap Fosamax
Purchase Rhinocort
Buy Nicotinell
Order Dostinex
Order Watson
Order Cipro
Cheap Confido
Cheap Lortab
Premium Diet
Koflet

Deploying ASP.NET MVC Applications

Posted by Jason on November 28, 2008 at 10:56 pm

Now I’m a huge fan of the ASP.NET MVC framework. So much so that I have taken to porting across applications already started using the Castle Monorail framework. Why? Well, there’s just a nice, warm, supported feeling when using a framework that is built-in to your chosen development platform.

Or at least that’s what you’d think. You know how it is - you get it all working on your lovely development machine and then once the decision has been made on where to host the final result, you upload your application and…bang…

HttpException (0x80004005): The incoming request does not match any route.

Oh yes, that works so well.

Suddenly that belief that, finally, someone has produced a framework which is so nicely integrated with your target platform comes crashing down around your head as you weep softly into your keyboard. No, ASP.NET MVC is not actually supported on anything under IIS7. Does your host offer IIS7 at the moment? I guess not.

Now don’t get me wrong, it does work on IIS6 but you have to mangle it a bit and unless you pay a fortune each month for access to your own virtual server then you’re likely to lose those pretty urls. That’s not the same as being supported. For those that have spent the last two hours Googling and still getting the same problem, here is the man with the answer:

http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

Buy Hyzaar
Cheap Koflet
Cheap Triphala
Arava
Cheap Arava
Order Prograf
Biaxin
Purchase Diovan
Buy Zyloprim
Cheap Fosamax
Cyklokapron
Buy Speman
Fioricet
Order Soma
Purchase Acomplia
Order Casodex
Purchase Speman
Buy Percocet
Order Cystone
Zocor
Purchase Pamelor
Buy Lanoxin
Cheap Zyloprim
Cheap Meridia
Cheap Purinethol
Purchase Celexa
Purchase V-Gel
Purchase Lamisil
Order Danazol
Buying Didrex
Order Kytril
Cheap Xeloda
Purchase Evista
Renalka
Buy Lincocin
Cheap Danazol
Order Carisoprodol
Buy Hydrochloride
Lexapro
Order Levitra
Buy Arava
Order Keftab
Cheap Trazodone
Cheap CLA
Purchase Acticin
Buy Elavil
Cheap Elimite
Purchase Risperdal
Order Prandin
Cheap Penisole
Order Femcare
Order Avandamet
Buy Dilantin
Order Lasuna
Order Dilantin
Order Diethylpropion
Herbal Maxx
Buy Sinequan
Superloss Multi
Buy AyurSlim
Buy Herbolax
Cheap Rocaltrol
Order Lisinopril
Buy Accutane
Buy Hytrin
Lisinopril
Cheap Buspar
Order Rumalaya
Cheap Propecia
Order Nimotop
Cephalexin
Purchase Vantin
Inderal
Buy Capoten
Purinethol
Buy Combivent
Cheap Casodex
Purchase Retin-A
Reosto
Buy Adderall
Aristocort
Cheap Brite
Percocet
Desyrel
Purchase Diakof
Order Zebeta
Order Ultram
Buy Emsam
Cheap Acticin
Pletal
Buy Tablet
Order Levaquin
Order Diakof
Buy Allegra
Cheap Protonix
Order Plendil
Purchase Parlodel
Buy Adipex
Order Chitosan
Zimulti
Cheap Amaryl
Premium Diet
Purchase Plan
Cheap Avandia
Purchase Menosan
Buy Triphala
Toprol XL
Purchase Himcocid
Purchase Lioresal
Purchase Inderal
Purchase Biaxin
Cheap Viagra
Purchase Avandia
Purchase Feldene
Purchase Cymbalta
Penisole
Phentrimine
Cipro
Cheap Nimotop
Cheap Requip
Purchase Zerit
Mental Booster
Buy Risperdal
Flexeril
Order Singulair
Koflet
Order Mentat
Order Herbolax
Buy Rocaltrol
Grifulvin V
Purchase Vasotec
Cheap Rimonabant
Buy Lasix
Cheap Singulair
Order Zantac
Order Vicodin
Order Himplasia
Buy Nonoxinol
Order Loprox
Prevacid
Purchase Zantac
Purchase Zyprexa
Orgasm Enhancer
Ventolin
Bupropion
Famvir
Purchase Allegra
Purchase Cipro
Order Flonase
Imdur
Purchase Lotrisone
Epivir-HBV
Buy Rumalaya
Cheap Prevacid
Female Viagra
Buy Adalat
Cheap Effexor
Cheap Prilosec
Order Amaryl
Starlix
Cheap Augmentin
Buy Aciphex
Cheap Arimidex
Order Snoroff
Buy Keftab
Purchase Lynoral
Prozac
Purchase Zimulti
Buy Superman
Cheap Coumadin
Cheap Oxycontin
Lozol
Buy Serophene
Detrol
ActoPlus Met
Buy Vicodin
Buy Prozac
Buy Mobic
Purchase Omnicef
Order Evista
Cheap Levaquin
Purchase Himcolin
Mexitil
Buy Effects
Cheap Flomax
Cheap Quibron-T
Lopressor
Cheap Atarax
Buy Synthroid
Buy Clomid
Buy Alprazolam
Cheap Nicotinell
Buy Procardia
Viagra Soft
Ephedrine
Order Valium
Purchase Prometrium
Cheap Parlodel
InnoPran XL
Purchase Alprazolam
Order Crestor
Cheap Actos
Buy Cozaar
Cheap Viramune
Cheap Pravachol
Isoptin
Purchase Avodart
Purchase Effexor
Buy Zovirax
Order Famvir
Zovirax
Buy Atacand
Purchase Requip
Buy Femcare
Cheap Vicodin
Purchase Amoxil
Cheap Plavix
Cheap Emsam
Zebeta
Rhinocort
Buy Hydrocodone
Purchase Confido
Buspar
Cheap Nonoxinol
Zyrtec
Mentax
Order Retin-A
Cheap Exelon
Buy Starlix
Order Karela
Purchase Herbolax
Cheap Vasodilan
Order Cialis
Purchase Hydrocodone
Cheap Prednisone
Order Antabuse
Parlodel
Buy Diazepam
Cheap Lincocin
Norvasc
Buy Prevacid
Order Topamax
Buy Mexitil
Purchase Purinethol
Buy Nirdosh
Buy Lukol
Cheap Tenormin
Mysoline
Order Celebrex
Arimidex
Order Zelnorm
Buy Imitrex
Tenormin
Purchase Methocarbam
Order Nolvadex
Purchase Ismo
Order Aleve
Copegus
Order Depakote
Cheap Oxytrol
Cheap Himcolin
Purchase Adalat
Purchase Clarinex
Purchase Cheap
Purchase Gasex
Cheap Levothroid
Order Rocaltrol
Buy Aceon
Karela
Order Adalat
Buy Lariam
Order Abana
Menopause Gum
Cheap Tenuates
Buy Zerit
Order Exelon
Cheap Ophthacare
Buy Singulair
Buy Omnicef
Cheap Shoot
Aceon
Rumalaya Forte
Order Vantin
Buy Effexor
Buy Cytotec
Requip
Cheap Sumycin
Hoodia Weght
Purchase Watson
Buy Sumycin
Triphala
Lotrisone
Order Trazodone
Elavil
Cheap Carisoprodol
Ansaid
Order Tenormin
Order Augmentin
Purchase Flomax
Feldene

The trouble with the right-alignment of input fields

Posted by Jason on July 11, 2008 at 11:32 am

Everyone knows that when you have a text box which accepts a number, it should automatically right-align the text content. Well maybe not everyone, but accountants certainly do and if you’re writing an application for an accountant it just won’t look right unless the values are right-aligned.

Simple, I thought - text-align:right in the CSS and the jobs a good ‘un. Well yes, you would think so. The fact of the matter is that text-align:right is only supposed to apply to block level elements (according to the CSS2 specs), although it isn’t quite implemented that way in all browsers. So, add display:block in there as well just to be on the safe side:

Left Align: <input style=”padding: 0px; text-align: right; display: block” type=”text” />

Right Align: <input style=”padding: 0px; display: block” type=”text” />

Job done! Well, not quite if you are viewing this in Internet Explorer 7. Click in the input field which is aligned to the right and no cursor displays at all! I must be tired today because this took me ages to work out and I found no reference to it anywhere in the web. For some reason the cursor is there - it’s just off to the right a little too far. I say ’some reason’ when I now know that the actual reason is that the padding is set to 0px. The reason for this happens to be because it has inherited the property from other elements in my form layout, but in this example I have added it specifically. Add a little padding to the right and hey presto:

Left Align: <input style=”padding: 0px 1px 0px 0px; text-align: right; display: block” type=”text” />

Right Align: <input style=”padding: 0px 1px 0px 0px; display: block” type=”text” />

That’s just strange. Zero padding displays the cursor on the left, but not the right. Except in Firefox, which just shows it correctly in either case.

CakePHP and clean URLs

Posted by Jason on July 28, 2007 at 11:39 am

Now don’t get me wrong - I love CakePHP and I know there’s a good reason for the controller/action format of urls. In fact I often find it helps to have a framework that forces that sort of thinking on me all the time since most of the sites I write are more application than website. It’s a bit like the good old days when I was struggling to get my head around the concept of OO after coming from a very procedural background. I could probably have done with a framework then too.

So I do think that it’s great for web applications, but not necessarily for web sites. Clean urls have many touted advantages over controller/action urls for a web site. I’m not sure how many are true (things like Google favouring them seem like a good reason, if that is actually the case) but for me it’s best simply because they are not controller actions. A ‘contact me’ page is a ‘contact me’ page. It’s not really an action on a particular controller in your application. An ‘about’ page is similar - it just seems wrong to say ‘about’ is an action on ‘pages’. Well, it does to me anyway. Whilst I usually write web applications there is almost always a web site component like this to them and I think it’s fine to seperate those two concepts even when they’re on the same site.

Now it’s true that you can write static pages directly to the webroot, but my clients almost always want some management control over those pages. As much as I’d like them to have to come back to me every time they want to change a word it just doesn’t seem particularly fair and just harms my chances of repeat business! All of the other solutions I came across just seemed rather complex and often slightly dodgy. So I came up with a simple solution of my own that works fine.

Basically you add an entry to routes.php for each of these pages:

$Route->connect('/contact/*', array('controller' => 'pages', 'action' => 'contact'));

This will redirect any call to ‘/contact’ to ‘/pages/contact’, but without giving that fact away to the user. It’s true that you can’t now have a controller called ‘contact’ but then you wouldn’t want one anyway (the main reason being controller names should be plural when following the Cake conventions!). You can add as many of these lines as you like. If you end up with more than 2 or 3 you might want to question whether those pages should have been part of a controller!

Using checkboxes in CakePHP

Posted by Jason on July 3, 2007 at 10:26 pm

Something that’s had me confused for a couple of hours today is using a checkbox in my CakePHP application. I’ve been using the html helper to create the relevant html and was initially confused by the fact that it not only creates the input element but also a preceding hidden input element.

<input type="hidden" name="data[Item][big_rock]" value="0" id="ItemBigRock_" />
<input type="checkbox" name="data[Item][big_rock]" id="ItemBigRock" value="1" />

So I did the best thing I could think of and ignored it, but when I came to creating the form to edit existing values I just ended up getting strange results. The checkboxes seemed to have a life of their own, checking and un-checking at will between post-backs. Google came up with several posts about the general problem most people come across with checkboxes - the fact that they post back nothing if they are not checked, but it took me far too long to actually put the strange hidden input field and this standard behaviour together. In my defence, there is very little documentation on this (that I could find) for CakePHP.
(more…)

Setting up CakePHP with fastCGI

Posted by Jason on July 2, 2007 at 11:36 am

Cake PHP LogoI’ve been using CakePHP for quite a while now with no .htaccess issues at all, either running locally or on hosted sites. That all changed last night when I couldn’t get it to work at all on one of my budget hosting sites. Instead of my application all I saw were 500 Internal Server Errors.

I found that the issue was definitely down to one line in the root .htaccess (which was unmodified from the original CakePHP download):

RewriteRule (.*) app/webroot/$1 [L]

Unfortunately my cheaper hosting doesn’t allow me access to the error logs so it was difficult to diagnose the problem. By 11:00 last night I was certainly not in a good mood and no closer to an answer. I managed to Google plenty of references to similar issues but none solved my problem.

This morning I resorted to the hosting company themselves and within an hour they came up trumps! My thanks to Rob at VirtualNames support who not only worked it out, he even changed the file for me!

It looks like the problem is that the mod_rewrite rules don’t like fastcgi, which is the preferred option for this hosting account - it seems to try and redirect the internal URLs for fast cgi causing a rewriting loop. VirtualNames support felt it would probably work if the PHP mode is switched back to module mode, but they also came up with a fix to the .htaccess in the domain folder to (the root .htaccess for the CakePHP installation):

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

This stops it trying to redirect the fastcgi internal access urls, and appears to cure the problem. It looks like the other .htaccess files do not need changing. .htaccess and rewrite rules are still a bit of a black art to me. After this they are going on my list of things to pick up!

I can also recommend VirtualNames as a budget hosting solution should you need one. Their support people actually do…erm…’support’ ;)

Setting up for web development on OS X

Posted by Jason on June 16, 2007 at 4:12 pm

I’ve been slowly working through all of the bits I usually use for web development on my MacBook, attempting to get it set up in a similar way to my PC. No particular reason for that, it’s just what works for me and means I can swap between machines whenever I like - PC for the working week and Mac for out-of-hours seems to be my pattern…

On the whole it has gone fairly smoothly, though it hasn’t been entirely without problems. Here is the detail of what I have set up and where I came across issues. It might help someone if they come from a similar background to me of PC development.
(more…)

Google has the right idea

Posted by Jason on September 28, 2006 at 5:22 pm

I envy this guy deeply:

http://steve-yegge.blogspot.com/2006/09/good-agile-bad-agile_27.html

I’ve spent a lot of time recently using Google and Google based technologies (Google Earth, Google Mail, Google Home Pages, Google Analytics, Google Spreadsheets, etc, etc) and I just never fail to be impressed. I didn’t even mention creating my own modules for my Google Home Page which is just a joy. Being a developer of SharePoint Web Parts from time to time I have a view of the ‘other side’ and just how hard it is to get things to work as you want. It’s always too complicated - people just want information and my job of getting that to them is far harder than it should be.

But Google stuff just works! It’s simple, and it JUST WORKS! The way they get to work results in people creating stuff that other people want. It must be the way they work, I can’t see anything else that would cause that effect.