You can set Session Timeout inside any Event in a Page.
For example if you want to set Session Timeout for a particular page, then simply write down the following Code inside Page_Load Event of that particular page:
protected void Page_Load(object sender, EventArgs e)
{
Session.Timeout = 1800;
}
And if you want to set Session Timeout when user Clicks a particular Button or Any Control, the simple you can Set Timeout property of Session inside any Control Event as per your Requirement.For Example see below.I'm Setting timeout property inside Button_Click event:
protected void Button1_Click(object sender, EventArgs e)
{
Session.Timeout = 1800;
}
Hope It'll help you.