从经典 asp.net 应用程序打开 mvc 应用程序
Opening a mvc application from classic asp.net application
我有一个完全开发的 MVC 应用程序,它具有使用自定义成员资格的登录功能。
我的客户有一个经典的 asp.net 应用程序,必须有自己的登录功能(没有登录的确切细节可能是简单的数据库用户允许登录或 windows 身份验证)
客户端应用程序将有一个按钮,单击该按钮应重定向到我的 mvc app/somecontroller/someaction
我试过如下正常编码,但应用程序没有重定向。
protected void btnConfig_Click(object sender, EventArgs e)
{
string mywebUrl = System.Configuration.ConfigurationManager.AppSettings["mywebUrl"];
//It is like localhost:9108
/* I have tried setting cookie same way as it is set in my mvc app */
//string cookiedata = "admin";
//string userData = string.Empty;
//var expiretime = DateTime.Now.Add(FormsAuthentication.Timeout);
//FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, cookiedata, DateTime.Now, expiretime, false, userData);
//string encTicket = FormsAuthentication.Encrypt(authTicket);
//HttpCookie formAuthCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
//Response.Cookies.Add(formAuthCookie);
Response.Redirect(mywebUrl + "/Home/Index", true);
}
此按钮单击代码位于 asp.net 我想打开 MVC 应用程序的应用程序中。
我犯了一个非常愚蠢的错误。
protected void btnConfig_Click(object sender, EventArgs e)
{
Response.Redirect("http://localhost:5555" + "/Home/Index");
// I was missing http:// in my url
}
我有一个完全开发的 MVC 应用程序,它具有使用自定义成员资格的登录功能。 我的客户有一个经典的 asp.net 应用程序,必须有自己的登录功能(没有登录的确切细节可能是简单的数据库用户允许登录或 windows 身份验证)
客户端应用程序将有一个按钮,单击该按钮应重定向到我的 mvc app/somecontroller/someaction
我试过如下正常编码,但应用程序没有重定向。
protected void btnConfig_Click(object sender, EventArgs e)
{
string mywebUrl = System.Configuration.ConfigurationManager.AppSettings["mywebUrl"];
//It is like localhost:9108
/* I have tried setting cookie same way as it is set in my mvc app */
//string cookiedata = "admin";
//string userData = string.Empty;
//var expiretime = DateTime.Now.Add(FormsAuthentication.Timeout);
//FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, cookiedata, DateTime.Now, expiretime, false, userData);
//string encTicket = FormsAuthentication.Encrypt(authTicket);
//HttpCookie formAuthCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
//Response.Cookies.Add(formAuthCookie);
Response.Redirect(mywebUrl + "/Home/Index", true);
}
此按钮单击代码位于 asp.net 我想打开 MVC 应用程序的应用程序中。 我犯了一个非常愚蠢的错误。
protected void btnConfig_Click(object sender, EventArgs e)
{
Response.Redirect("http://localhost:5555" + "/Home/Index");
// I was missing http:// in my url
}