-2
That’s the mistake you’re making:
This is the error line in my cshtml
@( new HtmlString((SessaoUtil.Recuperar("TagGoogle") != null ? SessaoUtil.Recuperar("TagGoogle").ToString() : "")))
This is my using in my cshtml
@model AgaxTurSiteOficial.Entities.PackageSearchInfo
This is my Packagesearchinfo class
public class PackageSearchInfo
{
public int chkpacotesroteiros { get; set; }
public int chkaereo { get; set; }
public int chkhotel { get; set; }
public int chkaluguelcarro { get; set; }
public int chkcruzeiros { get; set; }
public int chkingressos { get; set; }
public int chkseguro { get; set; }
public string txtDestino { get; set; }
public string txtOrigem { get; set; }
public string mesViagem { get; set; }
public string datIda { get; set; }
public string datVolta { get; set; }
public int intAdultos { get; set; }
public int intCriancas { get; set; }
public int quaAdulto { get; set; }
public int quaCrianca { get; set; }
public int quaMaisCinco { get; set; }
public int idGeoAreDestino { get; set; }
public int idGeoAreOrigem { get; set; }
public string idPacotes { get; set; }
public string SubMit { get; set; }
public string localPagina { get; set; }
public string[] passos { get; set; }
}
Honestly, I have another cshtml, with the same information that works. This procedure is standard for all our pages. I’m checking the other pages to see where it’s different, but I can’t find anything. Of course something is missing, but I don’t know what it is. I posted everything to try to help colleagues, giving as much information, because help the distance I know is bone. If any more relevant information is missing, just ask me to edit the post and send.
Sorry for the wrong information. The error line in my CSHTML is this.on top of Model.chkpacotesscripts != 0:
@{
if (Model.chkpacotesroteiros != 0)
{
@Model.mesViagem
}
else
{
@Model.datIda @:<br />a @Model.datVolta
}
}
The error is not in any code snippet of the ones you posted. Hint: the Debugger is your friend. Apparently you are already debugging the code. See which line the program stops on. Type exceptions
NullReferenceException
occur when you try to perform an operation on a null variable. And only check your variables one by one on the line where the error happens.– Oralista de Sistemas
This is the error line. It was misspelled by me. @( new Htmlstring((Sessaoutil.Recover("Taggoogle") != null ? Sessaoutil.Recover("Taggoogle"). Tostring() : "")))
– pnet
SessaoUtil
is static?– Leonel Sanches da Silva
I take back what I said about the error not being in the codes posted. What the Gypsy said makes perfect sense.
– Oralista de Sistemas
Your doubt is authentic @pnet, however, I don’t know if this issue will be really useful to other users in the future... because it seems it was a mere lack of attention. If that’s the case, I’d rule her out.
– Miguel Angelo