如何使用ASP.NET来检查是否启用了Cookie,而没有网页? [英] How can I use ASP.NET to check if cookies are enabled without having a web page?

查看:277
本文介绍了如何使用ASP.NET来检查是否启用了Cookie,而没有网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个桌面应用程序,可自动处理多个网站并处理返回的数据。此应用程序将在服务器上运行,用户将与远程桌面连接。当服务器没有启用Cookie,而不是让应用程序停止工作时,自动化会中断,我想检查服务器设置,并告诉用户为什么它不工作。



为此,我决定创建一个ASP.NET Web服务。我认为Web服务可以存储cookie,然后尝试访问数据。



我已经阅读了许多教程,例如: http://www.csharphelp.com/2006/05/c-and-cookies/ ,介绍如何存储和通过ASP.NET访问cookie。所有这些都使用一个网站。用户单击按钮以生成请求,然后Web服务可以发送响应。我不知道如何使该过程的工作,没有一个网站,我不想自动化我自己的主机的网站。我觉得我应该能够在我的web服务上运行一个方法,它应该工作。



有没有人知道如何做?我想要一个webservice,可以处理请求和响应,以便我可以创建,存储和访问cookie。



Nathan Tornquist



编辑:



我在一个数据库驱动的应用程序。其中一些是自动化网站,用户放入一些数据,然后程序打开一个web浏览器控件,填写表单,然后格式化结果数据。我想测试是否基于用户的安全权限启用Cookie,以便我可以禁用自动化,并允许用户自己填写数据,如果需要。大多数网站需要Cookie才能登录。



这将在各种版本的Windows Server上运行。默认情况下,我认为webBrowser控件具有与Internet Explorer相同的安全设置。

解决方案

/ p>

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet设置\Zones

HKEY_CURRENT_USER\SOFTWARE\Microsoft\ Windows \CurrentVersion \Internet设置\Zones



在这些键下,您可能会看到一些键,如0,1,2,3 ...每个都是一个区域配置。



搜索每个区域中的条目:



1A02

1A03

1A05

1A06



因此您必须验证这些条目值是否等于0.



查看以下链接:



ms kb

问题


I am working on a desktop application that automates numerous websites and processes the returned data. This application will be run on a server and the user will connect with remote desktop. The automation breaks when the server doesn't have cookies enabled, and instead of having the application stop working, I would like to check the server settings and tell the user why it isn't working.

To do this, I decided to create an ASP.NET Web Service. I figured that the web service could store the cookie and then try to access the data. If the data is found, cookies are enabled and everything is good to go.

I have read numerous tutorials like: http://www.csharphelp.com/2006/05/c-and-cookies/ that explain how to store and access cookies through ASP.NET. All of these however use a website. The user clicks a button to generate a request and the web service can then send a response. I do not know how to make the process work without having a website, and I do not wish to automate a site of my own hosting as well. I feel like I should be able to run a method on my webservice and it should work.

Does anyone know how this would be done? I'd like a webservice that can handle request and response so I can create, store, and access cookies. I thank you for any help that you may offer.

Nathan Tornquist

EDIT:

I am working on an database driven application. Some of the pieces are automated web sites, where the user puts in some data and then the program opens up a webBrowser control, fills in the forms, and then formats the resulting data. I would like to test if cookies are enabled based on the users security privileges so that I can disable automation and allow the user to fill in the data on their own if required. Most of the websites require cookies to log in.

This will be running on various versions of Windows Server. By default I think the webBrowser control has the same security settings as Internet Explorer.

解决方案

You can verify those keys on registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones

Under those keys, you may see some keys like 0, 1, 2, 3 ... Each one is a Zone configuration.

Search for those entries in each Zone:

1A02
1A03
1A05
1A06

So you have to verify if those entries values are equals to 0.

See those links:

ms kb
question

这篇关于如何使用ASP.NET来检查是否启用了Cookie,而没有网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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