A
Andrew Fisher
Hi there.
I am finally moving over to ASP.NET as the company I work for is
updating certain systems, ,so forgive me if this quesiton has been
answered before [I can't seem to find an answer].
I am using C# for this.
As a test I have built a class that sets up a wrapper around the
SmtpMail object so that with only a couple of statements an email can
be sent [this is just a test as this replicates what we will really be
doing with business objects].
So, to save on memory etc, I'd like to load this custom email class
into an Application object - something like
pmx.EmailSender Application["emailer"] = new EmailSender();
So it can be reused wherever in the application.
I'd then like in whatever .aspx file to be able to call the object as:
Application["emailer"].SendEmail (to, from, body);
And it will do it.
I've put the first bit of code into the global.asax file and it throws
an error:
Syntax error, bad array declarator. To declare a managed array the rank
specifier precedes the variable's identifier.
But I'm not sure what this means and if I am even approaching this the
write way.
Weirdly I seem to find loads of information saying you can store
Objects in the Application object but then everyone just uses the
example Application["varname"] = "some string"; - Not really the height
of complexity!
Any help or suggestions would be very greatly appreciated.
Cheers
AndrewF
I am finally moving over to ASP.NET as the company I work for is
updating certain systems, ,so forgive me if this quesiton has been
answered before [I can't seem to find an answer].
I am using C# for this.
As a test I have built a class that sets up a wrapper around the
SmtpMail object so that with only a couple of statements an email can
be sent [this is just a test as this replicates what we will really be
doing with business objects].
So, to save on memory etc, I'd like to load this custom email class
into an Application object - something like
pmx.EmailSender Application["emailer"] = new EmailSender();
So it can be reused wherever in the application.
I'd then like in whatever .aspx file to be able to call the object as:
Application["emailer"].SendEmail (to, from, body);
And it will do it.
I've put the first bit of code into the global.asax file and it throws
an error:
Syntax error, bad array declarator. To declare a managed array the rank
specifier precedes the variable's identifier.
But I'm not sure what this means and if I am even approaching this the
write way.
Weirdly I seem to find loads of information saying you can store
Objects in the Application object but then everyone just uses the
example Application["varname"] = "some string"; - Not really the height
of complexity!
Any help or suggestions would be very greatly appreciated.
Cheers
AndrewF