如何从控制台应用程序中访问aspx页面 [英] How to hit aspx page from console application

查看:268
本文介绍了如何从控制台应用程序中访问aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a situation in which I have a aspx page ,that hit on schedule ,all my logic is written in this page.I want that while this page is hit on schedule time,no console window or page that was hit,will not show up.what I have done to hide console window ,


 
But Problem is when that page is hit using this code ,that page open up in browser?





我尝试过:





What I have tried:

1.just change it to window application output in application setting. 
2.and to start aspx page 




<pre lang="vb">
Dim url As String = ""
            url = ConfigurationManager.AppSettings("www.youtube.com")
            Process.Start(url)

推荐答案

当您使用Process.Start时,它会启动一个新的Windows应用程序 - 这意味着操作系统查看您告诉它要处理的文件,找到要打开的相应应用程序它并开始。在这种情况下,它是一个URL,因此Windows将自动打开一个浏览器窗口 - 就像您在Windows资源管理器地址栏中键入www.youtube.com一样。除非通过更改整个窗口的默认互联网浏览器,否则无法阻止这种情况。



如果您想在不显示网站的情况下打开网站,您将拥有要么在非控制台应用程序中使用WebBrowser控件,要么使用 WebClient类(System.Net) [ ^ ]并手动处理。
When you use Process.Start, it starts a new Windows application - which means that the operating system looks at the file you told it to deal with, finds the appropriate application to open it and starts that. in this case, it's a URL, so Windows will automatically open a browser window - exactly as if you had typed "www.youtube.com" into a windows explorer address bar. You cannot prevent that, except by changing the default internet browser for the whole of windows.

If you want to "open" a website without displaying it, you will have to either use a WebBrowser control in a non-console app, or the WebClient Class (System.Net)[^] and process it manually.


Dim url As String = ""
           url = ConfigurationManager.AppSettings("url")
           Dim client As New WebClient
           client.Dispose()


这篇关于如何从控制台应用程序中访问aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆