C# 如何重定向到DLL文件中存在的Aspx页面
我创建了一个.dll,在其中我在views文件夹中添加了一个aspx文件(位于根目录下)。我想调用dll文件类中的方法,并想将数据重定向到特定的aspx页面。以下是我在dll中的基本实现:C# 如何重定向到DLL文件中存在的Aspx页面,c#,asp.net,asp.net-mvc,C#,Asp.net,Asp.net Mvc,我创建了一个.dll,在其中我在views文件夹中添加了一个aspx文件(位于根目录下)。我想调用dll文件类中的方法,并想将数据重定向到特定的aspx页面。以下是我在dll中的基本实现: public void redirect(Dictionary<string, object> obj){ try{ Console.WriteLine("data received"+obj);
public void redirect(Dictionary<string, object> obj){
try{
Console.WriteLine("data received"+obj);
string encryptedValue = obj["data"].ToString();
string endpoint = obj["endpoint"].ToString();
if(!String.IsNullOrEmpty(encryptedValue)){
Console.WriteLine("Redirecting for Payment to : "+endpoint);
RedirectionProperty property = new RedirectionProperty(endpoint,encryptedValue);
Console.WriteLine(property.Url);
HttpContext.Current.Session.Add("url",property.Url);
HttpContext.Current.Session.Add("data",property.PaymentData);
HttpContext.Current.Response.Write("hello");
HttpContext.Current.Response.Redirect("/views/Redirect.aspx",false);
}
}catch(Exception e){
Console.WriteLine(e.Message);
throw new ApplicationException("Error performing Redirection ");
}
}
公共无效重定向(字典obj){
试一试{
控制台写入线(“接收数据”+obj);
字符串encryptedValue=obj[“数据”].ToString();
字符串endpoint=obj[“endpoint”].ToString();
如果(!String.IsNullOrEmpty(encryptedValue)){
Console.WriteLine(“将付款重定向到:+端点”);
RedirectionProperty=新的RedirectionProperty(端点,encryptedValue);
Console.WriteLine(property.Url);
HttpContext.Current.Session.Add(“url”,property.url);
HttpContext.Current.Session.Add(“数据”,property.PaymentData);
HttpContext.Current.Response.Write(“hello”);
HttpContext.Current.Response.Redirect(“/views/Redirect.aspx”,false);
}
}捕获(例外e){
控制台写入线(e.Message);
抛出新的ApplicationException(“执行重定向时出错”);
}
}
是否可以重定向到dll文件中存在的aspx页面?我想您要查找的是在单独的库中引用aspx页面。其基本描述如下:
dll中的aspx页?为什么?视图文件夹向我表示MVC环境的移动。DLL项目不是MVC项目。这是一个简单的控制台应用程序。我创建了一个名为“视图”的文件夹。无论如何,我都可以重命名它。我想调用DLL中cs文件中的方法,并想重定向到asp页面。