简体   繁体   中英

ASP.NET - Cron job with password protected page

I am trying to read an xml-feed into a database on a specific time with cron jobs. Everything is working fine (the cron job calls the page and the xml-script starts running and reading into the database) except that i dont want someone else to be able to run the script by visiting this page. Therefore I have been looking at setting up a password-protected page for this script, but there is not a lot of information about how to do this with cron jobs and asp.net.

It seems to be so much easier with php (use the htaccess-file and send the username and password with the cron-job url like http://username:password@yoursite.com/cron ). Is it possible to do this with asp.net sites?

I have to use cron job since my web hosting provider don't have windows task scheduler.

Thanks, Axel

您可以在特定于目录的web.config中使用通过保护的URL

Two points come to my mind

  1. http://username:password@yoursite.com/cron like url is useless for securing if https is not used. You can make you asp.net url equivalent to it using query string.
  2. If ssl is not possible why dont you enable ip checking that the code will only run when the page is requested from a specific ip(Linux server ip)??

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM