global.asax

.NET MVC - Windows Integrated Authentication + Authorization

Hi Guys, My question is similar to a crapload out there.. I have a simple app to be hosted internal to my company (accessed on the intranet). its an MVC app with windows integrated authentication. I have all the code to authorize a user against AD, but how do i implement this in the client (web.config + global.asax etc) Do i use the...

asp.net mvc 2 global.asax.cs being ignored

I was having trouble debugging why a route was throwing a 404 when I was positive I set it up correctly. I made changes, rebuilt, still 404, I did all kinds of crazy stuff to the route but always 404. then in my frustration I just deleted ALL the routing in global.asax, saved rebuilt and ran. I still got 404... but the rest of the site...

Conflict between Global.asx and CSS

Hi, I need to restrict multiple users from logging into my system. I am using Application_OnPostAuthenticateRequest event in global.asax to see if anybody is logged in. It works really well. But CSS is not loading and the screen looks horrible. If I comment out the code in that event, the page renders perfectly... What am I missing? W...

Global.asax, can I update it in production server?

I have an asp.net website in my production server which running fine now. Now I am using quartz.net for scheduled tasks and in my development system I have tested it. I want to move it to production server. My global.asax at present in production server: void Application_Start(object sender, EventArgs e) { Application["Hits"] = 0;...

Global.asax Error handling: Quirks of server.transfer

Hi, In my global.asax, I am checking for a 404, and transferring to the 404 error page as per the below: If HTTPExceptionInstance.GetHttpCode = 404 Then Server.ClearError() Response.TrySkipIisCustomErrors = True Response.Status = "404 Not Found" Server.Transfer("~/Invalid-Page.aspx") End If ...

Application_Error event in Global.asax not firing when browsing .php extensions

ASP.NET global.asax Application_Error fires for all pages except .php extensions. On IIS: "Web Service Extensions" does have PHP set to allowed. I have the PHP isapi filter on the web site. I recycled my defaultAppPool. Did the IIS reset. Still i cannot get the Application_Error to fire when viewing a php page that does not exist. W...

ASP.NET C# - Context.RewritePath in Global.asax Makes my site super slow.

I have multiple domain names, all pointing to the same wwwroot. www.domain1.com www.domain2.com www.domain3.com my folders look like this: /domain1-folder -->/domain2-folder -->/domain3-folder I use the global.asax as following: protected void Application_BeginRequest(Object sender, EventArgs e) { if (Request.Url.Host == "...

global.asax Application_Error not firing

My global.asax seems not to be firing. I have: void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs Server.Transfer("~/ExceptionFormView.aspx"); } In my web.config, I don't have anything lie CustomErrors. As I want everything to be handled by Global.asax and transferred to Exc...

Application_Error event not being fired with CustomError page in web.config

I have an asp.net website and i have a block of code in my global.asax's Application_Error event to send the error details(stack trace etc..) as an email to my email id.Also i have Custom error page set in my web.config.I published the website in release mode and deployed to production.When i access the site,I got some errors and i was s...

How to Determine ASP.NET Application Domain Lifetime

We have an application gathering counter statistics and we would like the values to reset after executing the iisreset command and that's all. Microsoft says Application_Start is: Called when the first resource (such as a page) in an ASP.NET application is requested. The Application_Start method is called only one time durin...

Centralized ASP.NET error handling: <customErrors> vs. Application_Error. Is it possible to use both?

Currently, we are doing error handling via Application_Error in global.asax.vb: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) OurLibrary.HandleError(Me) End Sub HandleError then logs the error into a database, displays an informative message to the user and returns the correct status code (404 or 500) dependi...

Roles lost after being set in Global.asax Application_Start()

Hi, In the master page for my site, i have added several LoginView controls that use roles to determine if menu items should be displayed to the logged in user. In my Global.asax Application_Start() event i am adding roles for a set of users as defined in my Web.Config file (as additions to those already in Active Directory) - Like so:...

NullReferenceException in Global.asax when referencing Context.User.Identity in Session_Start

When I am debugging an application in ASP.NET, after about ~5 minutes I get a NullRefEx coming from global.asax.cs regarding: protected void Session_Start(Object sender, EventArgs e) { WindowsIdentity identity = null; identity = (WindowsIdentity)(Context.User.Identity); ... Context is Null at this point...

Global.asax for php

I've been a .Net developer and a Java developer and TBH I liked .Net more when it comes to web (Except that I had to use IIS). Recently I've learned php (Amazingly simple) but I was wondering if in php you could do something like the Global.asax in .Net. I'm just looking for someway to mimic the Application_Error event. Does anyone know ...

Handling Start Up Issues With NHibernate In Global.asax

I have a WCF Service, hosted inside of IIS, using NHibernate for data access. In my Global.asax I configure NHibernate on Application_Start. This means that I only perform the expensive task of setting up all of the mappings once for my WCF Service. The only problem with this is that if the database was unavailable during start up, the...

asp.net Global.asax events and cookie

Hi All, how can i read and write cookie in Global.asax file under Application_BeginRequest event. when i tried, it gives me the error "Response is not available in this context". i am doing it for localization. Please give me the solution. thanks in advance ...

Confused over global.asax?

I have a class called Global that derives from HttpApplication. Oddly, I see a lot of methods inside Global that look like: void Application_Start(object sender, EventArgs e) { } The code is definitely executing inside this method, so the method is being called from somewhere, but where? The methods aren't marked overload? Secondly,...

Global.asax.cs file is not recompiling--file is valid

I recently refactored some code, and a method the original Global.asax.cs file was depending on was no longer static. When I made changes to my Global.asax.cs code to fix the compilation problem, VisualStudio Development Server is still reporting the old problem. To make things more confusing, it's reporting the old problem with the ne...

to rewrite url in Global.asax, ASP.NET

HEllo. I need replace double slashes in one slash. I am planning do this in Global.asax Application_BeginRequest event. Is it enough? or better do a http module? Thank you. UPD Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) ' Fires at the beginning of each request Thread.CurrentThread.CurrentCul...

Multiple Global.asax files per web application project

I have existing web application project in which i need to add new subdirectory. In this subdirectory i need to add WCF service. Question is: Can i use different AppDomain then services from root directory? Also, can i add new global.asax just for this subdirectory? ...