• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Ajax throwing internal server error after few hours

I have an asp.net MVC web application that works completely fine on the local server. The code is below

public static int SessionID = Convert.ToInt32(SessionIDStaticController.GlobalSessionID);  [HttpPost]         public ActionResult AllSubjectsOfStudent()         {             try             {                 var userID = User.Identity.GetUserId();                 var UserRole = db.GetUserRoleById(userID).FirstOrDefault();                 int ClassID = db.AspNetClasses.Where(x => x.SessionID == SessionID).FirstOrDefault().Id;                  var AllSubjectsOfStudent = from Subject in db.GenericSubjects                                            join StudentSubject in db.Student_GenericSubjects on Subject.Id equals StudentSubject.GenericSubjectId                                            where StudentSubject.StudentId == userID                                            select new                                            {                                                Subject.Id,                                                Subject.SubjectName,                                             };                   return Json(AllSubjectsOfStudent, JsonRequestBehavior.AllowGet);             }catch(Exception ex)             {                 return Json(ex, JsonRequestBehavior.AllowGet);             }            } 

The ajax code is below

$.ajax({             type: "POST",             url: "/StudentCourses/AllSubjectsOfStudent",             data: {},             success: function (data) {                 console.log(data);                 $.each(data, function (key, value1) {                     $("#Subjectlist").append(' ');                 })              }         }) 

After publishing the application on Plesk, the ajax stops hitting the backend controller after a few hours and throws an internal server 500 error. To resolve it, I've to publish it again and after publishing it starts working for another couple of hours.

Please Note: Such behavior starts appearing after the implementation of the SSL.

Is there any solution to it that it should work all of the time. I've added console.log and try-catch block but since ajax isn't hitting the controller, I'm only getting internal server 500 error. I was checking it every 30 minutes and found that in the first 6 hours of publish it works fine, after that it can stop working at any time.

Can someone provide any solution or approach to fix it?

Thanks.

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]