active-directory-aspnetcore-webapp-openidconnect-v2 icon indicating copy to clipboard operation
active-directory-aspnetcore-webapp-openidconnect-v2 copied to clipboard

jquery/Ajax call fails when Authentication cookies is timeout

Open devamirsaleem opened this issue 2 years ago • 0 comments

Hi,

I am using Azure Ad authentication in my ASP.Net 4.8 MVC application. When authentication is expired and when user clicks on the link or button user get redirected to login page. So that is good.

However, I have a problem with AutoComplete textbox which is also available on the same page among buttons and link. If user leave the app open and comes back after page authentication cookie is expired and enter a value in autocomplete textbox, then textbox doesn't do anything, it behaves as if user did type space. There is no redirection or even a error message. This only happens when authentication is expired which is usually around 60 minutes.

When I debug the code I found that when user clicks enter the value in the textbox then call is made to to controller and controller get created. After code leave the constructor then nothing happens. No error and no finding where does the code ended.

Any help please.

Just in case if the code is needed so here it is.

                @{
                    try
                    {
                        @(Html.Kendo().AutoComplete()
                .Name("searchValue")  //chaninging the name of the class to UserModel
                .DataTextField("SearchString") //DataTextField("dataField")
                .Filter("contains")
                .MinLength(2)

                .HtmlAttributes(new {style = "width:100%"})
                .DataSource(source =>
                {
                    source.Read(read =>
                    {

                        read.Action("GetAutoComplete", "Job")
                            .Data("onAdditionalData");
                    })
                        .ServerFiltering(true);
                })
                //.Events(e => e.DataBound("onDataBound"))
                )

                    }
                    catch (Exception e)
                    {
                        //this.RedirectToAction("Reporting", "ReportManagement");
                    }

                }

devamirsaleem avatar Feb 21 '23 20:02 devamirsaleem