Questions tagged [global-asax]

A special file in the ASP.NET framework, it provides a simplified interface to create hooks into system events in the life cycle of a web application and web pages in that application.

A special file in the ASP.NET framework, it provides a simplified interface to create hooks into system events in the life cycle of a web application and web pages in that application.

Most often used to define resources which need to be globally defined for use by all web pages and services.

1047 questions
10
votes
4 answers

ASP.Net Session_Start event not firing

I have an ASP.Net 2.0 application in which the Session_Start event is not firing in my Global.asax file. Can anyone tell why this is happening and how I can get it working? The application worked fine on my Windows XP development machine, but…
Jazza
  • 1,042
  • 1
  • 9
  • 22
10
votes
1 answer

Server.Transfer in Global.asax

I have a custom error handler in the global.asax's Application_Error method, when an error occurs I use the following code to transfer user to the error page: Server.Transfer("/Error/"); However without specifying the actual page name the code…
Maya
  • 1,414
  • 5
  • 22
  • 43
10
votes
3 answers

HttpApplicationState not available in an MVC controller

I'm using MVC2 and VS2010 developing a website and need to use Application State global values. I can set a value like 'Application["hits"]=0;' in Global.asax but when trying to use the same in an MVC controller always get the following error: The…
Mehrdad
  • 149
  • 3
  • 11
10
votes
10 answers

Prevent expiration of individual sessions based on custom conditions?

A website I am working on is very data centric. Some reports take more than an hour to complete. Whenever a user submits a request for a report, a new thread is created which generates the report. The user is then redirected to a page which says…
Ratna
  • 2,289
  • 3
  • 26
  • 50
10
votes
4 answers

Understanding routing in Global.asax (asp.net-mvc)

In Global.asax what does the following signify? routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
9
votes
2 answers

Application_Start not being hit in ASP.NET web app

I'm trying to debug something in the global.asax.cs file in an ASP.NET web app and have set a breakpoint in the Application_Start() event however that event is not getting fired when I start the web app inside VS2008. I'm targeting the 3.5…
Guy
  • 65,082
  • 97
  • 254
  • 325
9
votes
4 answers

Why is global.asax missing from a Website Project

A couple of questions regarding the role of global.asax: Why is it not included in the Website Project in Visual Studio? Are there other ways of achieving the same functionality without this file? If I would create a Web Application project, as far…
Dor Rotman
  • 1,511
  • 1
  • 15
  • 27
9
votes
1 answer

How does Global.asax PostAuthenticateRequest event binding happen?

How can I use the PostAuthenticateRequest event of Global.asax? I'm following this tutorial and it mentions that I have to use the PostAuthenticateRequest event. When I added the Global.asax event it created two files, the markup and the code-behind…
Tux
  • 105
  • 1
  • 2
  • 4
9
votes
2 answers

How to create controller object and execute action with parameter from global.asax

I have this code in global.asax protected void Application_Error(object sender, EventArgs e) { // ... var routeData = new RouteData(); routeData.Values.Add("controller", "Home"); …
Muflix
  • 6,192
  • 17
  • 77
  • 153
9
votes
4 answers

Application_error function intermittently catch "File does not exist"

I am using the Application_Error event for handling the exceptions and it catches almost all exceptions correctly. However in some pages it catches with exception "File does not exist" and I am not able to find from where it exactly occurs. When I…
Anto Varghese
  • 3,131
  • 6
  • 31
  • 38
9
votes
6 answers

How to create Global variables, ASP.NET, global asax

I have some data layer classes that are to be used very frequently almost on the whole site. I was working on a windows application previously and i used to create its object in module (vb.net) but now i m working in C# and on ASP.NET. Now i need to…
Shantanu Gupta
  • 20,688
  • 54
  • 182
  • 286
9
votes
1 answer

Global.asax in Umbraco 6

I had the following in my Global.asax (Umbraco 4.7) Application_Start Application_EndRequest Application_Error Session_Start Session_End Now I have upgraded to Umbraco 6.0.3, which global.asax inherits from Umbraco.Web.UmbracoApplication Where do…
Aximili
  • 28,626
  • 56
  • 157
  • 216
9
votes
1 answer

Application_EndRequest not finding Session

I'm trying to set a cookie in Application_EndRequest in Global.asax.vb as suggested in ASP.NET OutputCache and Cookies I've written the following code, cookie gets ERROR value. Why isn't session available? Sub Application_EndRequest(ByVal sender As…
JNF
  • 3,696
  • 3
  • 31
  • 64
9
votes
1 answer

using PreSendRequestHeaders Event in global.asax

I tried to assign the PreSendRequestHeaders Event in the global.asax file in the "Application_Start" method. But this does not work. private void Application_Start() { PreSendRequestHeaders += OnPreSendRequestHeaders; } private void…
Chris
  • 4,325
  • 11
  • 51
  • 70
8
votes
1 answer

F# Global.asax -- language not supported?

Im trying to write a simple F# ASP.Net MVC app Ive added the Global.asax as follows <%@ Application Inherits="WebApplication.Core.Global" Language="F#" %> then in a separate referenced assembly I have namespace WebApplication.Core with a type…
Chris McKelt
  • 1,378
  • 2
  • 17
  • 38