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
0
votes
1 answer

Where should Global.asax reside on an ASP.NET MVC 4 solution with multiple projects?

If for example I have a solution with two projects: Project.Core and Project.Web. Now I set Project.Web as the startup project. Shall global.asax reside on the root of this project (Project.Web)? If so, do I also have to include the App_Start folder…
csoon1
  • 27
  • 5
0
votes
1 answer

'the directive control is unknown' after adding a new Global.Asax file

I've added a brand new 'Global.asax' file to my web project and got the following error when trying to build it: 'the directive control is unknown'. All the solutions I've read about in the web is talking about errors which where caused by…
ohadinho
  • 6,894
  • 16
  • 71
  • 124
0
votes
1 answer

Application_BeginRequest for static *.JS files in ASP.NET in IIS6?

I'm trying to do something seemingly simple: ensure that Application_BeginRequest is called for every static *.JS URL sent to my IIS6 website, whether or not the underlying file exists. What's a good way to do this on IIS6 & ASP.NET 3.5, ideally…
Justin Grant
  • 44,807
  • 15
  • 124
  • 208
0
votes
0 answers

c# asp.net mvc session start being called multiple times

I have a web site. I am using the session start in global.ascx and while debugging I noticed that it is being called a few times, and jumping from line to line what seems to be different threads. is that normal? must I use the lock statement here?
mashta gidi
  • 849
  • 1
  • 10
  • 30
0
votes
1 answer

Using Global.asax file to load user preferred interface language

I am working on a multi-lingual ASP.net web application using C# and .Net 4.0. The web application allows the user to save his preferred language for the user interface. There is also a provision to change the user interface language using a…
itsbalur
  • 992
  • 3
  • 17
  • 39
0
votes
1 answer

logging off a user when the session times out

I am creating a mvc4 application and here I am creating a cookie to give a user access to various pages depending on their roles and things. but I have different doubt. Instead of logging off people generally tend to close the browser window. So, I…
Sindhoor
  • 142
  • 4
  • 11
0
votes
1 answer

Global.asax Application_Start Get Action Url / RedirectToAction?

On application start I am checking app versions from the assembly against a value stored in the web.config. If the versions differ, I want to trigger the default installer. So I need to get an Action route. But this doesn't seem possible to do as…
YodasMyDad
  • 9,248
  • 24
  • 76
  • 121
0
votes
1 answer

Not all errors catched by global.asax C#

I am attempting to catch all errors except '404-File not found' error in global.asax file and writing in to a text file in server,But lot of errors gets missed ,like FormatException Error,Sessionout Error and "Yellow Page of Error" Appears ! How can…
sajanyamaha
  • 3,119
  • 2
  • 26
  • 44
0
votes
1 answer

Avoid handle 404 on other requests than main

I used the method below in the EndRequest method from global asax. I get a HTTP 404 error even from image request or other requests. The point is that I want to check only for the first request/main request. Can you help me please. This is the only…
Pop Radu
  • 17
  • 5
0
votes
1 answer

MapPageRoute() vs. Site's Root Directory Repeatedly Loads Target Resource

I have the following line in Global.asax.cs: routes.MapPageRoute( "Resorts", "{resortname}", "~/Pages/ViewResort.aspx" ); The intention is to allow a request like: www.mysite.com/some-resort-name to load this resource (more or…
Bob Kaufman
  • 12,864
  • 16
  • 78
  • 107
0
votes
1 answer

Losing custom headers on HTTP 500

As part of Global.asax's BeginRequest event I conditionally add a CORS header based on a web.config value. HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); I lose this header when an HTTP 500 occurs. I've stepped through…
ryan
  • 6,541
  • 5
  • 43
  • 68
0
votes
2 answers

Where to implement Global.asax methods

I am working on an ASP.Net application and currently the Global.asax contains the usual 5 methods: Application_Start Application_End Session_Start Session_End Application_Error However, I needed to implement the Application_AuthenticateRequest…
03Usr
  • 3,335
  • 6
  • 37
  • 63
0
votes
1 answer

ASP.Net use of documents

I have a problem in my asp.net application. The users can access a document, but only one user can access one document at the same time. When a user gets a document, a flag in the db is updated for the document, indicating that the document is in…
javier
0
votes
1 answer

Web client software factory CreateNewAttribute property not working in global.asax

We are using the following code in a code behind page [CreateNew] public AdminController Controller { get; set; } and the following code within the controller class [ServiceDependency] public IAdminService Adminervice { get; set; } this works fine…
Paul Rowland
  • 8,244
  • 12
  • 55
  • 76
0
votes
2 answers

Exceptions, Global.asax, and the eventlog

I would like to log unhandled exceptions from the global.asax to the Application eventlog. However, I've noticed that IIS is already logging these unhandled exceptions as warnings. Is there a way to suppress these messages since I'm planning on…
tribus
  • 1,110
  • 1
  • 9
  • 27