Solved

Global.asax methods in Asp.net web application

Posted on 2013-10-31
3
659 Views
Last Modified: 2013-11-05
Experts,

I have just created a new Asp.net web application and could not find "Application_AuthenticateRequest" and "Application_AuthorizeRequest" methods in Global.asax.cs file but can see other methods Session_Start,Session_End,Application_Start,Application_End and Application_Error methods.

The Global.asax.cs file is inheriting from System.Web.HttpApplication and if I go to definition and can see "public event EventHandler AuthenticateRequest" and "public event EventHandler AuthorizeRequest" as events.

How can I add "Application_AuthorizeRequest and Application_AuthenticateRequest"
methods to the Global.asax.cs file?

Thanks in Advance
0
Comment
Question by:ksd123
3 Comments
 
LVL 22

Accepted Solution

by:
Mrunal earned 50 total points
ID: 39613804
Hi
You can directly add those two methods directly in same file.
protected void Application_BeginRequest(object sender, EventArgs e)
{

}

protected void Application_AuthenticateRequest(object sender, EventArgs e)
{

}

Open in new window

After that add debugger for these functions, check whether execution pointer comes there or not.
0
 

Author Comment

by:ksd123
ID: 39613828
I can add those methods directly , but  just wondering I can't see the methods using intellisense ? Any idea ?
0
 
LVL 41

Assisted Solution

by:guru_sami
guru_sami earned 50 total points
ID: 39614621
They are not in intellisense but mainly work based on convention. You can add handler for an application level Event by using Application_eventname.

Check these:
msdn.microsoft.com/en-us/library/fwzzh56s(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/system.web.httpapplication_events.aspx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now