global-asax

ASP.NET customErrors with mode=remoteOnly and global.asax handling exceptions

☆樱花仙子☆ 提交于 2019-12-10 13:09:19
问题 I have custom errors set in the web config file as follows: <customErrors mode="RemoteOnly" defaultRedirect="GenericError.aspx" /> Fine and dandy... I like that mode="RemoteOnly" facilitates development... For unhandled exceptions, I have in global.asax: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Response.Redirect("GenericError.aspx") End Sub However, unhandled exceptions are going to the generic error page instead of the informative yellow screen of death preferred

Turn off Files/Folder changes in Global.asax in asp.net

梦想与她 提交于 2019-12-10 12:11:21
问题 Anti-virus scans the .Net deployed folders. Because of this, application gets logged out frequently for the customers. Requires lot of approval in order to get exemption at the folder level for the project. So, I used below code: //FIX disable AppDomain restart when deleting subdirectory //This code will turn off monitoring from the root website directory. //Monitoring of Bin, App_Themes and other folders will still be operational, so updated DLLs will still auto deploy. System.Reflection

Enable CORS in Sharepoint 2013

对着背影说爱祢 提交于 2019-12-10 11:40:45
问题 I need to make CORS from/to various Sharepoint domains, and of course handle the OPTIONS preflight request. After a lot of research I found that this solution is (almost) the best for my needs. Modify global.asax let you handle more than one domain with credentials passed, and the OPTIONS preflight request. The bad side is that after applying it as suggested, you can't login in Sharepoint Designer anymore. I modified global.asax as below, CORS are ok, but Sharepoint Designer no. public void

Exception thrown in end_request when adding headers

回眸只為那壹抹淺笑 提交于 2019-12-10 08:02:01
问题 Occasoinally i get this exception thrown (viewable in elmah) System.Web.HttpException: Server cannot append header after HTTP headers have been sent. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Web.HttpException: Server cannot append header after HTTP headers have been sent. at System.Web.HttpHeaderCollection.SetHeader(String name, String value, Boolean replace) at System.Web.HttpHeaderCollection.Add(String name, String

How does Global.asax PostAuthenticateRequest event binding happen?

我与影子孤独终老i 提交于 2019-12-09 16:06:13
问题 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 file. Here is the content of the code-behind file using System; using System.Web; using System.Web.Security; using System.Web.SessionState; namespace authentication { public class Global : System.Web.HttpApplication { protected void Application

Global.asax parse error after minor change and revert to previous version

余生长醉 提交于 2019-12-09 09:19:00
问题 The project in context is: ASP .NET Web Application .NET Framework: 4 Platform Target: x86 IDE: Visual Studio 2010 Ultimate SP1 Multiple projects in solution with ASP .NET being the startup project. It has been in production for months without glitches until yesterday. I cleaned up the [Global.asax] file (removed unused using statements, refactored, etc.), ran the solution and got the following error: Description: An error occurred during the parsing of a resource required to service this

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

陌路散爱 提交于 2019-12-09 05:24:53
问题 In Global.asax what does the following signify? routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 回答1: This is one of the really frustrating things about learning MVC - the documentation for this feature is awful - there's just hardly anything there: http://msdn.microsoft.com/en-us/library/dd470170(VS.100).aspx. routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); This allows all the something.axd files to run outside of MVC - that "{*pathInfo}" at the end allows query strings to be ignored (it

Enable CORS in Sharepoint 2013

爱⌒轻易说出口 提交于 2019-12-09 00:52:28
I need to make CORS from/to various Sharepoint domains, and of course handle the OPTIONS preflight request. After a lot of research I found that this solution is (almost) the best for my needs. Modify global.asax let you handle more than one domain with credentials passed, and the OPTIONS preflight request. The bad side is that after applying it as suggested, you can't login in Sharepoint Designer anymore. I modified global.asax as below, CORS are ok, but Sharepoint Designer no. public void Application_BeginRequest(object sender, EventArgs e) { string httpOrigin = Request.Params["HTTP_ORIGIN"]

How do I log unhandled exceptions in ASP.NET MVC?

倖福魔咒の 提交于 2019-12-08 19:10:48
问题 Here's what I'm trying to do in my Global.asax.vb: Public Class MvcApplication Inherits System.Web.HttpApplication Shared Sub RegisterRoutes(ByVal routes As RouteCollection) routes.IgnoreRoute("{resource}.axd/{*pathInfo}") routes.MapRoute( _ "Error", _ "error.html", _ New With {.controller = "Error", _ .action = "FriendlyError"} _ ) ... 'other routes go here' ... End Sub Sub Application_Start() RegisterRoutes(RouteTable.Routes) End Sub Sub Application_Error(ByVal sender As Object, ByVal e As

Get names of Online users connected to a Server

我怕爱的太早我们不能终老 提交于 2019-12-08 03:56:40
问题 I am new to asp.net. I have gone through this link which has shown how to count the online users connected to a server using asp.net. ( which is working when I tried ) My question is: What should I change in that code (Global.asax) so that It shows all the names of the connected users instead of counting them. I created a chat application which stores the name of the connected user in a variable chatUsername in js file as shown below: js file var chatUsername = window.prompt("Enter Username:"