Application object isn't visible in the cshtml page
Folks,
I'm clearly missing something, which is not surprising, because I'm new to ASP.NET.
I'm making a session counter, which is incremented in the Session_Start() event and decremented in Session_End(). (This is just an exercise. I found it here.)
I have created a Global.asax file and added the event handlers. So far so good.
Then I wanted to access the Application object in a .cshtml file, but the Application object is not available. It's underlined with a red squiggly line.
What could I be missing?
Any suggestion, insight or reference is really appreciated!
Cheers,
- Nick
Re: Application object isn't visible in the cshtml page
Well you appear to have opened an MVC project, and to be honest if you are new to ASP.Net you might be better off starting with a standard ASP Web Forms project.
If i where you i would open a new project and when selecting project type select ASP Web Forms,
MVC is a particular design pattern (for which ASP.Net has its own project type) BUT the example you are following is just expecting a standard Web Forms project.
Re: Application object isn't visible in the cshtml page
My little test project is WebPages rather than MVC. However, I want to get some familiarity with MVC soon.
I have already looked into WebForms. It may be easier to learn, but it doesn't look to me that WebForms is the future. From what I gather, majority of new developments are MVC.
I'm new to ASP.NET, but I'm not new to programming. I'm not afraid of learning intricate concepts. I'm working on a hobby project at my own pace.