Click here to Skip to main content
16,015,351 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Hi,
in file Global.asax i add some code for sending mails. In the top of the Global.asax file is
C#
<%@ Application Language="C#" Inherits="AspDotNetStorefront.Global" %>

and bottom i add
C#
<script  runat="server" Language="c#">
   //my code and breakpoint in same line
</script>

If i remove
C#
Inherits="AspDotNetStorefront.Global"
then sending mails works, but is the problem with another files (dont find some data - null exception). But if i leave this code, then program never comes farther than the
C#
<%@ Application Language="C#" Inherits="AspDotNetStorefront.Global" %>


Why program with Inherits does not perform all that is in this file? Can i move my code in another file? But this code should be carried out all the time, because it is sending e-mails at a given time.

Thanks
Posted
Comments
Ranjeet Patel 25-Jun-14 7:22am    
I would suggest it to move it to the other file. because in global.asax file I have never seen anybody to use inherit.

And what do you mean by sending mail at given time ? please explain.
you can put your sending email code in separate class and call the class whenever you want to send the mail.
vezo11 25-Jun-14 7:37am    
I want to check every day if specific conditions are fulfilled, then send an email to selected users. Threading is the bad solution for this, so i chose Scheduled Task; this link. Do you have any better idea?

This should be checked every 12 or 24 hours.

Thanks
Dinesh.V.Kumar 26-Jun-14 2:07am    
Use a windows service for this purpose. You can configure the service to run at any specified time to send the email.

Regards
vezo11 26-Jun-14 4:37am    
Thanks, i already try this but I have to use a specific method of this project. I wouldnt want again to writecode that already exists. Or is there any chance to that service can use classes and methods from another project?
Dinesh.V.Kumar 26-Jun-14 5:16am    
I Suppose you can do that. Just put it in a separate project. Create a Class Library, add that to your service and try invoking those methods.

Regards,
Dinesh Kumar.V.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900