2015-11-25 1 views
0

У меня есть следующая бритва, но если я перейду непосредственно к URL-адресу, он выбрасывает нулевую ссылку. Я посмотрел на Request.Url.Host и ни одна из этих частей не равны нулю, что может быть проблема:Условный стиль с использованием исключения бритвы null null

@{ 
Layout = "NoNavigationMaster.cshtml"; 

var brand = Common.GetProductBrand(Request.Url.Host); 

if (brand == BrandType.SCT) 
{ 
    <style type="text/css"> 
       div.products-filter-overlay-body div.bg-image { 
        position: absolute; 
        height: 100%; 
        width: 100%; 
        bottom: 0; 
        top: 0; 
        left: 0; 
        right: 0; 
        background: url([email protected]) no-repeat center center fixed; 
        background-size: cover; 
       } 
      </style> 
} 
else if(brand == BrandType.BullyDog) 
{ 
    <style type="text/css"> 
        div.products-filter-overlay-body div.bg-image { 
         position: absolute; 
         height: 100%; 
         width: 100%; 
         bottom: 0; 
         top: 0; 
         left: 0; 
         right: 0; 
         background: url([email protected]) no-repeat center center fixed; 
         background-size: cover; 
        } 
       </style> 
} 
} 
+0

Каков ваш метод 'Common.GetProductBrand()'? –

ответ

0

Не зная тело метода Common.GetProductBrand это трудно сказать. Может быть, бритва @ 2x равна нулю. Поместите точку останова на них и проверьте их значения