作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以,我在这个线程上看到了这个问题
基本上我想知道如何实现资源拦截器,因为我找不到它。我也在使用 C#,我在对象浏览器中搜索并没有找到类...
这是我的代码..或多或少与上面的线程相同
public class CustomInter : ResourceInterceptor
{
protected override ResourceResponse OnRequest(ResourceRequest request)
{
request.Method = "POST";
request.AppendUploadBytes("klik_login=1&outkey=323e82945803f3eb68798709237d2ac7&username=asd&password=asd123", 100);
request.AppendExtraHeader("Content-Type", "application/x-www-form-urlencoded");
return null;
}
}
这行不通,有什么建议吗?
最佳答案
这是一个工作示例(使用 .NET4/x86):
public class customInter : IResourceInterceptor
{
public ResourceResponse OnRequest(ResourceRequest request)
{
// Put your code here
return null;
}
public bool OnFilterNavigation(NavigationRequest request)
{
return false;
}
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void WebCoreOnStarted(object sender,
CoreStartEventArgs coreStartEventArgs)
{
var interc = new customInter();
WebCore.ResourceInterceptor = interc;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
var interc = new customInter();
WebCore.ResourceInterceptor = interc;
// Replace "webControl1" and Uri with your information
this.webControl1.Source = new Uri("http://example-site.com");
}
}
关于c# - 如何实现 ResourceInterceptor Awesomium 1.7.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18248851/
所以,我在这个线程上看到了这个问题 Awesomnium Post Parameters 基本上我想知道如何实现资源拦截器,因为我找不到它。我也在使用 C#,我在对象浏览器中搜索并没有找到类... 这
我是一名优秀的程序员,十分优秀!