如何把本项目中的aspx页面嵌入到WinForm中?
建了个项目,有网页也有Form,想启动程序时把aspx页面嵌入到WinForm中,知道用WebBrower控件了,但还是不知道具体该怎么做,谁能给个详细的代码?
------解决方案--------------------.aspx 打到winform里的exe也用不了啊。没有asp_wp进程的"解析",aspx页面跟一般的文本文件一样。。。
------解决方案--------------------弄个服务器比较好。
------解决方案--------------------用脚本的话是webBrowser1.Document.script.a.a  
不过后期绑定的话要invoke,比较麻烦  
参考http://www.codeproject.com/useritems/How2LateBinding.asp
------解决方案--------------------Bs的项目读取的是另一台有权限限制机子上的文件,可以试试将哪个机子上要访问的文件夹设置为完全共享
------解决方案--------------------用WebBrower其实就是实现一个小型浏览器功能,
输入URL,在winform里可以连接到IIS,解析该url,
所以web的还是需要安装IIS服务器。
------解决方案--------------------一个简单的demo如下:  
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
   [System.Runtime.InteropServices.ComVisibleAttribute(true)]
   public partial class Main : Form
   {
       public Main()
       {
           InitializeComponent();
       }   
       private void button4_Click(object sender, EventArgs e)
       {
           this.webBrowser1.Navigate(this.textBox1.Text);
           this.webBrowser1.ObjectForScripting = this;
       }
       #region JavaScript中调用的方法
       public string InvokeFormMethod(string message)
       {
           MessageBox.Show(message);
           return "Charles2008";
       }
       #endregion
       #region 调用Javascript方法
       private void button6_Click(object sender, EventArgs e)
       {           
           this.webBrowser1.Document.InvokeScript("msgalert", new string[] { "Called from client code" });
       }
       #endregion
   }
------解决方案--------------------使用 winform 中的 WebBrowse 空间就可以了
------解决方案--------------------首先你的网页文件需要在IIS上部署
然后可以在Winform中使用WebBrowser控件将页面内容显示出来