Okta Redirect issue while refresh session

Hi Team,

I am facing an issue while working with okta.
while first time login, my application works fine but suppose I am in different page now and I kept my page idle for sometime. it refresh page and redirect to the old page.
in every page, in page load event I kept below code but it doesn’t work.
if (!Request.IsAuthenticated)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
IdentityModelEventSource.ShowPII = true;
HttpContext.Current.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = Request.Url.AbsoluteUri, AllowRefresh = true },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}

this code when I have written it doesn’t redirect to same page.

Are you using one of our SDKs? If so, can you share which one and which version? Can you share what this method is doing? When you say “old page” which page are you referring to?

Yes, we are using OKTA for authenticate the user.
we are using OKta.AspNet version 3.2.3.0

Below the code in my OwinStartup class

var oktaoptions = new OktaMvcOptions();
oktaoptions.LoginMode = LoginMode.OktaHosted;
oktaoptions.OktaDomain = ConfigurationManager.AppSettings[“okta:OktaDomain”];
oktaoptions.ClientId = ConfigurationManager.AppSettings[“okta:ClientId”];
oktaoptions.ClientSecret = ConfigurationManager.AppSettings[“okta:ClientSecret”];
oktaoptions.AuthorizationServerId = ConfigurationManager.AppSettings[“okta:AuthorizationServerId”];
oktaoptions.RedirectUri = ConfigurationManager.AppSettings[“okta:RedirectUri”];
oktaoptions.GetClaimsFromUserInfoEndpoint = true;
oktaoptions.Scope = new List { “openid”, “profile”, “email”, “groups” };
app.UseOktaMvc(oktaoptions);

could you please help me why if I keep my page idle for sometime, then click on same page anything say button click, it refresh the page and redirect to page (redirect URI) instead of same page.

If session expire and ask for username and password then we can say it is fine but it just refresh the page and redirect to the page (which is my redirect URI or my start page in ASP.Net web form)