All:
I’m new at C#, lifelong VB coder. I’m trying to do something in ASP.NET that I commonly do: Inherit System.Web.UI.Page.
I’ve created the class for the ‘InheritedPage’, and now I’m pointing my web page to it like this. In VB, the ‘load’ code in the inherited page runs automatically (before the web page ‘load’)
In C#, it appears that I have to actually call the ‘load’. Can you confirm that I’m doing this correctly?
namespace Vendor
{
public partial class Vendor : InheritedPage
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
//do I need this?
InheritedPage_Load(sender, e);
//more code here
}
catch (Exception ex)
{
throw ex;
}
}
}
}
Inherit class
namespace Vendor
{
public class InheritedPage : System.Web.UI.Page
{
public void InheritedPage_Load(object sender, EventArgs e)
{
//how do i get this to run automatically?
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
}
}
}