RBS
asked on
MVC - Ensure launched page is not cached
Hi:
I have an MVC 4 app in which the controller launches a page showing all of the student's lessons and a button beside each that the student can press to launch the lesson. There is also an check mark beside each lesson showing whether that student has previously launched the lesson.
The controller code to launch the lessons page looks like this:
Now the student goes away in a flash module - takes the lesson and when s/he finishes, the _enrollmentsRepository and database are updated indicating that the student has completed the lesson.
I then have a bit of javascript that brings the user back to my page that launched the lesson.
It looks something like this:
This worked fine when I was using a forms application. The user was redirected to the page which loaded the updated records and showed the lesson has having been completion.
With MVC, however, I get the original cached version of the page and have to do a browser refresh in order to see the check mark beside the recently completed lesson.
I have tried various things such as
but am still unable to return to the calling page with refreshed data.
Any help in solving this greatly appreciated.
RBS
I have an MVC 4 app in which the controller launches a page showing all of the student's lessons and a button beside each that the student can press to launch the lesson. There is also an check mark beside each lesson showing whether that student has previously launched the lesson.
The controller code to launch the lessons page looks like this:
public ActionResult EnrollmentModules(int id)
{
//Get list of all student's lessons with checkmark beside each showing completion status and button to launch
var enrollment = _enrollmentsRepository.GetById(id);
@ViewBag.PageTitle = enrollment.Course.Name;
return View(_moduleRecordsRepository.GetModuleRecordsByEnrollment(enrollment));
}
Now the student goes away in a flash module - takes the lesson and when s/he finishes, the _enrollmentsRepository and database are updated indicating that the student has completed the lesson.
I then have a bit of javascript that brings the user back to my page that launched the lesson.
It looks something like this:
qs = "http://myOriginalCallingApp.com?StudentId=27;
top.document.location.href = qs;
"This worked fine when I was using a forms application. The user was redirected to the page which loaded the updated records and showed the lesson has having been completion.
With MVC, however, I get the original cached version of the page and have to do a browser refresh in order to see the check mark beside the recently completed lesson.
I have tried various things such as
var destination = top.document.location = qs;
destination.reload(true);
but am still unable to return to the calling page with refreshed data.
Any help in solving this greatly appreciated.
RBS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I replaced the "&_t" with "?t" and it worked like a charm!
Thanks,
RBS
Thanks,
RBS
You said :
I see a question mark here, so I'm not sure why you add a new one...
It looks something like this:
qs = "http://myOriginalCallingApp.com?StudentId=27;
I see a question mark here, so I'm not sure why you add a new one...
ASKER
"A potentially dangerous Request.Path value was detected from the client (&)."
RBS