473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

custom functions in global.asax

Hi all,

Is it possible to have custom function/subroutines in global.asax? e.g.
DoMyWork(i as integer) etc etc. If yes, how can I access this code in my
..aspx pages? I know I can put this into a seperate dll in the bin directory,
but to keep it simple global.asax would be nice too..

TIA!
Nov 19 '05 #1
1 2187
Yes, you can make them public static in global.asax.

However, this is not a good idea. It makes it
much more of a hassle if you choose to reuse that
method in another web application or in a different
environment such as a .NET Windows Forms
application or .NET Compact Framework application.

You really should stay consistant with your OOP layers
and not get lazy by just throwing code in your global.asax
all willy nilly.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

<pa***@community.nospam> wrote in message
news:e9***************@TK2MSFTNGP15.phx.gbl...
Hi all,

Is it possible to have custom function/subroutines in global.asax? e.g.
DoMyWork(i as integer) etc etc. If yes, how can I access this code in my
.aspx pages? I know I can put this into a seperate dll in the bin
directory, but to keep it simple global.asax would be nice too..

TIA!

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: David P. Donahue | last post by:
When I wrote websites in VB .NET, I would often put functions in Global for all the pages to call. Now, in C#, doing so results in "references to non-static objects" and whatnot. I realize what...
2
by: Ron | last post by:
I need to write a custom textbox control that references an object located in the Global.asax class, but I can't compile the control into a DLL without including the reference to the project DLL...
0
by: Ranv | last post by:
Is it possible to use web.config to handle 404 Page Not Found errors, and application level custom errors (in global.asax) to handle all other errors? I suppose I would have to make sure that I...
3
by: Mr Newbie | last post by:
I'm testing error handling configurations and having some trouble. I created a WebForm called. ErrDefault.aspx and I am trying to use the Page error attribute to force the redirection to a custom...
1
by: Stu | last post by:
Hi, Im using vis studio 2003 and I think wse is out of the question as clients could be using java which doesnt support it. So I managed to find some code which allows you to develop a custom...
0
by: gilly3 | last post by:
I'm coming across all kinds of frustration implementing custom errors in ASP.NET 1.1. First, 401 - Authorization Failed My application uses Windows Integrated Authentication, and restricts...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
3
by: David | last post by:
Hi, I have seen in some site implementations code has been entered into global.asax.cs in its own function, not any of the regular application or session functions that exist in here. What I...
5
by: rote | last post by:
I'm using ASP.NET 2.0 and i have copied and pasted the code below to my Global.asax file but it desn't trap the error I want to trap the 401 access denied void Application_Error(object sender,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.