It's been a while since I have posted a question, but I'm really puzzed by this one particular behaviour in my MVC project.
This is my first project in MVC and I'm still learning. Here's my dilema, I have a system that utilizes an login process from a different system built in cold fusion. What happens is that once the user is authenticated in cold fusion, it redirects it to
my MVC system by passing me a querystring. I then proceeed to do a basic authentication and set some session variables. If it authenticates then it takes me to the actual main page of the MVC system.
Here's my problem, which happens sporadically and is never consistent.
Once I'm authenticated and on the Index view of my MainController, I check the code behind and for some strange reason the markup of the index.cshtml page is of the coldfusion login screen, and not of the index.cshmtl page. As a result, when a user clicks
a link on the index.cshtml it reloads the page and takes him to another screen of the coldfusion system, not to the actual link of my MVC system.
In other words I want to the user to go here <a href="@Url.Action("Detail", "MainRequest", new { id = item.Id, requestedfrom = "MainRequest" })">@Html.Raw(item.FormattedLeaveDates)</a>, but it's like the code behind doesn't have that link; hence it takes
me to a different page of the coldfusion application.
gzmbk1
Member
18 Points
44 Posts
Redirect and Markup error
Mar 20, 2012 03:23 PM|LINK
Hello experts
It's been a while since I have posted a question, but I'm really puzzed by this one particular behaviour in my MVC project.
This is my first project in MVC and I'm still learning. Here's my dilema, I have a system that utilizes an login process from a different system built in cold fusion. What happens is that once the user is authenticated in cold fusion, it redirects it to my MVC system by passing me a querystring. I then proceeed to do a basic authentication and set some session variables. If it authenticates then it takes me to the actual main page of the MVC system.
[NoCache]
public class AuthenticationController : Controller
{
//
// GET: /Authentication/
private LawsonServices _law_db = new LawsonServices();
public ActionResult LogOn()
{
string guid = Request.QueryString["guid"];
Session["guid"] = guid;
var employeerecord = _law_db.GetEmployeeRecordByGUID(guid);
if (employeerecord != null && guid != null)
{
SimpleSessionPersister.Username = employeerecord.firstName + " " + employeerecord.lastName;
SimpleSessionPersister.EmployeeId = employeerecord.empNum;
SimpleSessionPersister.isSupervisor = employeerecord.isSupervisor;
//return RedirectToAction("Index", "MainRequest");
return RedirectToRoute(new { Controller = "MainRequest", Action = "Index"});
}
else
{
return Redirect("http://inhouseconfusionsystem.com/?go=logout");
}
}
//GET: /LogOff
public ActionResult LogOff()
{
FormsAuthentication.SignOut();
Session.Abandon();
return Redirect("http://inhouseconfusionsystem.com/?go=logout");
}
//GET: /goToAppraisal
public ActionResult goToAppraisal()
{
string goUrl = "http://inhouseconfusionsystem.com/?guidAppraisal=" + Session["guid"];
return Redirect(goUrl);
}
}
Here's my problem, which happens sporadically and is never consistent.
Once I'm authenticated and on the Index view of my MainController, I check the code behind and for some strange reason the markup of the index.cshtml page is of the coldfusion login screen, and not of the index.cshmtl page. As a result, when a user clicks a link on the index.cshtml it reloads the page and takes him to another screen of the coldfusion system, not to the actual link of my MVC system.
In other words I want to the user to go here <a href="@Url.Action("Detail", "MainRequest", new { id = item.Id, requestedfrom = "MainRequest" })">@Html.Raw(item.FormattedLeaveDates)</a>, but it's like the code behind doesn't have that link; hence it takes me to a different page of the coldfusion application.
Any help would be appreciated
Regards
Peter
Juntao Zh - ...
Member
62 Points
16 Posts
Re: Redirect and Markup error
Mar 30, 2012 07:02 AM|LINK
The code should work. You could add some trace code to the app and see how it routes.