I'm not sure if you're after something that will log the user out
after a certain time regardless of activity, or just after a period of
inactivity.
If you're using standard http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx, this can be done for you without any major work:
but you did not provide enough info
Set up your http://msdn.microsoft.com/en-us/library/6e9y4s5t.aspx.
Ensure that your http://msdn.microsoft.com/en-us/library/532aee0e.aspx defines a loginUrl:
<authentication mode="Forms">
<forms loginUrl="login.aspx" />
</authentication>
You can set a timeout other than the default 30 minutes using the "timeout" attribute on the http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx:
<authentication mode="Forms">
<forms loginUrl="login.aspx" timeout="15"/>
</authentication>
This will log the user out after 15 minutes of inactivity on your
site (either with the browser open with no javascript "heartbeat" or if
they spend 15 minutes on another site).
Then ensure that your login, registration and possibly forgotten password pages are accessable to all users using the http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx
<location path="Logon.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<location path="Register.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<!-- etc -->
This way, when a user's authentication cookie expires they will be
redirected to the URL specified in the loginUrl element of your forms
page.
Hope you got enough idea.
The next time you post a question give some brief description,