If you are using form authentication then you don't have to write any custom code. For session timeout settings are provided by Framework itself. Just change the configuration file as mentioned below :
<authentication mode="Forms">
<forms defaultUrl="~/Default.aspx"
loginUrl="~/Login.aspx"
slidingExpiration="true"
timeout="60" />
</authentication>
Above configuration will redirect user to the login page when session expires.