Yes. Session out time can be set manually in web.config.
In a .NET interview, if you’re asked whether you can set the session timeout manually, the correct answer is yes, you can set the session timeout manually in ASP.NET.
In ASP.NET, session timeout can be configured in the web.config file using the <sessionState>
element. The timeout
attribute specifies the number of minutes a session can be idle before it is abandoned. Here’s an example:
<configuration>
<system.web>
<sessionState timeout="30" />
</system.web>
</configuration>
In this example, the session timeout is set to 30 minutes. You can adjust the value of the timeout
attribute to set the desired session timeout duration.
Additionally, you can also set the session timeout programmatically in your code using the Session.Timeout
property. For example:
// Set session timeout to 30 minutes programmatically
Session.Timeout = 30;
Both of these methods allow you to set the session timeout manually in ASP.NET.