14
голосов
2ответов
8038 просмотров

Пользовательские страницы ошибок приложения ASP.NET MVC не отображаются в среде общего хостинга

У меня проблема с пользовательскими ошибками в приложении ASP.NET MVC, которое я развернул на моем общем хосте. Я создал ErrorController и добавил следующий код в Global.asax, чтобы перехватывать необработанные исключения, регистрировать их, а затем передавать управление ErrorController для отоб...

0
голосов
2ответов
230 просмотров

Как что-то сделать в первую очередь при запуске сервера asp.net

Мне нужен интерфейс, который можно запускать в первую очередь при запуске приложения. Мы можем написать код в Application_Start global.ascx. Есть ли другой способ завершить его после некоторых настроек в web.config, я не хочу писать код в global.ascx Вы знаете, что мы можем реализовать интерф...

0
голосов
4ответов
3077 просмотров

Call javascript function from global.asax in asp.net mvc

How to call or make the javascript function from the Application_Start of global.asax in asp.net mvc(C#) application?

0
голосов
1ответов
233 просмотров

urlauthorization with custom roleprovider

I am interacting with a third party httpmodule for authentication. I implemented my custom roleprovider to interact with that. However they use a CustomPrincipal instead of the expected RolePrincipal for urlauthorization. In which event in global.asax can I hook to grab the customprincipal, inst...

3
голосов
2ответов
3333 просмотров

Help debugging - when does the Application_Start run in global.asax file?

Here's the snippet from my Global.asax: <script runat="server"> void Application_Start(object sender, EventArgs e) { // log this call EventLogger.Log("ApplicationStart"); } void Application_BeginRequest(object sender, EventArgs e) { // log what the us...

0
голосов
1ответов
347 просмотров

Subscribing Events in Global.Asax

I have some couple of events like when user subscribes to my newsletter it fires a subscribed event so that an e-mail will be sent to corresponding users to notify them about their subscriptions. But where should I handle those events ? What is the best practice to handle events ? Should I bind e...

0
голосов
2ответов
1420 просмотров

Using the Ninject NLogModule Logger in global.asax

I'm using Ninject for DI in my asp.net application, so my Global class inherits from NinjectHttpApplication. In my CreateKernel(), I'm creating my custom modules and DI is working fine for me. However, I notice that there is a Logger property in the NinjectHttpApplication class, so I'm trying t...

4
голосов
2ответов
4663 просмотров

ASP.NET Application Start without using Global.asax

I'm developing a plugin like application for a web site. Due to requirements it will live in the same physical path and the same application pool as the main web site which I do not have the source code for. So they both share the same Web.config and some other dependencies. I need to set a lice...

2
голосов
4ответов
1742 просмотров

Global.asax template not available in Visual Studio

When I attempt to "add new item" to my web project (by right-clicking, add new item) - there is no template for it. What might the problem be? I'm using VS2008. Additional Info: When I right click on the solution and "Add", "New Web Site" - I have zero tempates to choose from. I have tried run...

2
голосов
1ответов
680 просмотров

What can cause Application_Error not to be invoked?

For the last 2 weeks I have a case that I can't figure it out, maybe you guys already passed through the same problem or ear/read about it and can help me. I have an ASP.NET Project that I run on my machine and other machines fine, every time I try to temper the QueryString I get an error that i...

2
голосов
2ответов
11044 просмотров

.net Session state has created a session id, but cannot save it because the response was already flushed by the application

I have below in my global.asax Session_Start string myBrowser = Utils.SafeUserAgent(Request); foreach (string bannedbrowser in BrowserBan.BrowsersToBan) { if (myBrowser.IndexOf(bannedbrowser, StringComparison.OrdinalIgnoreCase) > -1) { HttpContext.Current.Response.Redirect("/bann...

0
голосов
2ответов
2679 просмотров

Can I show an alert from Global.asax on a page that's experiencing a SQL Timeout?

In Global.asax, is there a way to handle SQL Timeouts elegantly, and display a message on the requesting page explaining the error? I know Global.asax has the Application_Error and Error events, but I'm not sure which (if any) I could use to accomplish this. Related, can I access the page insta...

0
голосов
3ответов
4133 просмотров

ASP.NET Accessing cookie value in session_end event of global.asax

In ASP.NET , How can i retrieve a cookie value in the Session_End event of global.asax file ? The following code is throwing an exception "Object reference not set to an instance of an object" string cookyval = ""; try { cookyval = Context.Request.Cookies["parentPageName"]....

6
голосов
4ответов
11554 просмотров

classic asp/asp.net website - global.asa not working

I've recently been given a website written in classic asp to configure and set up - although it also appears to have pages written in asp.net. The problem I'm having at the moment is that it doesn;t appear to be picking up settings from the global.asa file such as Application("ConnectionString")...

2
голосов
2ответов
1917 просмотров

Handle application_start without global.asax

Is there a way to handle the application_start "event" without using the global.asax? The best I can come up with is an HttpModule that checks some static variable on every begin_request, which is INCREDIBLY wasteful :( Do I have any other options? Thanks

2
голосов
3ответов
1772 просмотров

global.asax and classic ASP?

Now please excuse me if this is a stupid question - BUT... In my ASP.NET apps, I have a global.asax file that catches an error and emails me the details. 'Could' I put the global.asax in the root of a classic ASP file and if there was an ASP error it would trigger the global.asax? Again sorr...

0
голосов
1ответов
891 просмотров

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 without causing all static files to go throu...

1
голосов
1ответов
662 просмотров

Profile_OnMigrateAnonymous event firing multiple times

We have an HTTPModule whose sole purpose is to do "url rewriting". By definition of an HTTPModule, ALL browser requests (html, css, javascript, images, etc) go through the event handlers of this class. During the signin process, we are catching the moment when the user switches from "anonymous" ...

0
голосов
1ответов
77 просмотров

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 use. When the user finnishes working with the docu...

5
голосов
2ответов
2152 просмотров

How to use and scope of global.asax (for file cleanup after application ends)

On the subject of dynamically storing temporary images and handling their cleanup on a web server's file system: (using C# in .NET 3.5). It was suggested that I use a global.asax file to handle this. I just can't figure out how this thing works. I have two separate applications... I have fig...

0
голосов
1ответов
543 просмотров

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 for a normal aspx page. I would like to au...

2
голосов
1ответов
550 просмотров

Can I map new routes to the RouteCollection outside Global.asax?

I'd like to occasionally map new routes to the RouteCollection during program execution long after the Global.asax RegisterRoutes() method had first executed. How can I do this?

5
голосов
2ответов
4451 просмотров

ASP.NET 2.0 : Best Practice for writing Error Page

In asp.net 2.0 web site, what is the best way of writing Error page. I have seen following section at following location: Web.Config <customErrors mode="RemoteOnly" defaultRedirect="~/Pages/Common/DefaultRedirectErrorPage.aspx"> Global.asax void Application_Error(object sender, Ev...

0
голосов
2ответов
1048 просмотров

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 logging them myself or do you think it’s reasonabl...

0
голосов
4ответов
5056 просмотров

ASP.NET 2.0: Problem in Httpcontext.current.session.add()

Can anybody help me to find out solution of following problem. In ASP.NET website: at Application_OnPostAuthenticate() event, whatever code i write is executed for every request. therefore due to this customidentity object, countryid and weatherid is called everytime for each request (call for...

2
голосов
3ответов
3487 просмотров

Should you use the method Application_Error in your global.asax in ASP.NET MVC?

I know that in ASP.NET people typically put a protected method called "Application_Error" in their global.asax file inorder to handle say, logging of exceptions. My question is, is this an ASP.NET only thing, or does it work equally well in ASP.NET MVC? Is it an ASP.NET MVC best practice or not?

10
голосов
4ответов
3896 просмотров

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

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

8
голосов
3ответов
31714 просмотров

ASP.NET: Access Session variable in global.asax

I have an ASP.NET application and in the Global.asax ' Application Error Event, I am calling a method to trace/log the error. I want to use the session variable content here. I used the below code void Application_Error(object sender, EventArgs e) { //get reference to the source of the exc...

2
голосов
1ответов
1844 просмотров

Application_BeginRequest is not being hit

I have a Website that is using .NET 1.1 app pool and then I also have a Virtual Directory within that website that is .NET 3.5. This Virtual Directory's contents are built with Visual Studio 2008 as a separate project. When testing, everything works fine and all Global.asax events are hit and t...

2
голосов
2ответов
3612 просмотров

Global.asax Application_Error doesn't work with Integrated Mode

Application_Error doesn't work with Integrated Mode but does work with Class Mode. I would to transfer request to error page using both Integrated Mode and Class Mode. Can this be done or I have to use HTTP module in order to support both modes? protected void Application_Error(object sender, Ev...