I have some data layer classes that r to be used very frequently, Almost in whole site.
I was working on window 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 do same thing so that i need not create same object multiple times on every page.
I want to use ...
I am using aspnet___compiler.exe to compile my asp.net 3.5SP1 websites,
then aspnet_merge.exe to merge the assemblies into a single one.
The assembly is then uploaded to the production server. This usually works pretty well but sometimes when testing on the staging server I get the
following message:
Parser Error Message: Could not ...
I was recently at a Techdays seminar, at the SOLIDify Your Microsoft ASP.MVC MVC Applications session. The instructor had a demo that had mapping Interfaces to Methods from the Global.asax file OnApplication_Start().
So anywhere in the web application he could simply do IDate.GetMyDate() and it would return the date.
I was wondering...
I would like to be able to selectively disable the FileAuthorizationModule early in the request pipeline for certain requests (which will be handled later on by my own code in any case).
The UrlAuthorizationModule seems to respect the Context.SkipAuthorization = true boolean, is there an equivalent to disable the FileAuthorizationModule...
Hi Gang,
I'm registering some components related to Linq2Sql using PerWebRequest lifestyle. I see them get created, but they get destroyed before my global's Application_EndRequest method gets called. Is that by design? Does anyone know a work around? I want to call commit on my UnitOfWork object to submitchanges() at the end of e...
I cant debug global.asax file! i have some codes in Application_Start() method but when I set break point in method it is ingonred! is this normal?
...
So in the Global.asax is this:
protected void Application_Error(object sender, System.EventArgs
{
Session["CustomError"] = Server.GetLastError();
Server.ClearError();
Response.Redirect("~/ErrorPage.aspx");
}
And in ErrorPage.aspx is this:
private void Page_Load(object sender, System.EventArgs e)
{
Excep...
This is the code I use to redirect from www. to non www. version of my site
void Application_BeginRequest(object sender, EventArgs e)
{
string authority = Request.Url.Authority;
if (authority.StartsWith("www."))
{
authority = authority.Remove(0, 4);
string newUrl = "http://" + authority + Request.Url.PathAndQ...
Problem: I am working on a ASP.NET 2.0/C# Application and I need to do the following:
I have a function I am using from a third-party library lets say
MyFunctions.CalculateTotal(int a, int b);
A known issue is that the thread locks resources. So there is another function that needs to be called afterwards to clean everything up.
M...
I'm in the process of adding ASP.NET MVC code to a preexisting ASP.NET Webforms project. The various tutorials suggest adding routing to a method called from Application_Start() in Global.asax. My Global.asax already has an Application_OnStart(Object,EventArgs) method with some setup code.
If I try to have both Start and OnStart, the On...
Hello,
could i use the begin request of Global.asax to redirect everything,
from mydomain.domain to www.mydomain.domain?
If this one is true, how can i do that?
...
I have an ASP.NET application where i am tracking my applicaion level erros using golabl.asax On_Error method.I will send an email to my id when there is some error happened in the site(ie :" when the application _error being invoked) Now From my global.asax's Application_OnError event, how can i get the URL of the page where this error ...
In ASP.NET ,Will session variables exist when Application_Error method being called from global.asax ?Can i access values of my session variables there ?
...
I need to redirect some of the older pages in my application to new pages. I thought urlMapping in web.config is the efficient way to achieve this. But there is also another way to redirect using global.asax. Which one is the efficient way for this. At what point in request execution does this asax and config file comes into the picture?...
My ASP.NET intranet web application uses Windows Authentication, and I would like to record the following details:
1) Windows ID
2) Session Start Time
3) Session Stop Time
4) URL being browsed to (optional)
I've got some basic code setup in "Session_Start" method of the Global.ASAX to log session start times (seen below), but that's it...
I'm recording the session start times from when people log into my .NET 2.0 web application, but I'd also like to record the Session ID. Can someone give me some example code on how to accomplish this (how to access the Session ID from within the Global.ASAX).
If you need any additional info just let me know.
...
I'm at a loss as to why my routes are conflicting. I have these in my Global.asax file:
routes.MapRoute(
"CustomerView", "{controller}/{action}/{username}",
new { controller = "Home", action = "Index", username = "" }
);
routes.MapRoute(
"Default", "{controller}/{action}/{id}",
ne...
I'm running a ASP.NET website on my development box (.NET 2.0 on Vista/IIS7).
The Session_Start method in global.asax.cs logs every call to a file (log4net).
The Session_End method also logs every call.
I'm using InProc session state, and set the session timeout to 5 mins (to avoid waiting for 20 mins).
I hit the website, wait for 5 mi...
How can I prevent certain file types from going through the ASP.NET Pipeline (hitting global.asax, etc.)?
...
A client has sent out an email with a link containging a typo for a website we run [E.g. http://example.com/?id=123.]. What is the best way to re-direct anyone who visits the bad URL?
If someone clicks on the link, can we catch it in the Global.asax, checking if the path ends with "." then removing it and re-directing? If so, where in G...