Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jun 29, 2010 @ 14:16
    Ismail Mayat
    0

    Scheduled task current user

    Guys,

    umbraco v:4.0.3 .net 35

    In umbraco settings we have scheduled tasks node where you can set url of task you want to run.  I am going to setup one up it points to ashx.  What i wanted to know is in the ashx is there a way of determining that the url has been requested from umbraco scheduler is there someting in the request object to tell me that scheduler is making the call?  Does scheduler run as a particular cms user eg admin and i can test for that?

    Many thanks

     

    Ismail

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Jun 29, 2010 @ 14:22
    Shannon Deminick
    1

    It will probably just run as an anonymous user since ASP.Net itself is making a WebRequest behind the scenes. I'm not sure what kind of request headers get sent up by the ASP.Net sub system, but you can have a look. This still wouldn't be the most secure way to check if it is the scheduled task system since people can change request headers with things like Charles or Fiddler.

     

  • Sean Mooney 131 posts 158 karma points c-trib
    Jun 29, 2010 @ 14:50
    Sean Mooney
    1

    You could always set a url parameter in the scheduled task settings:

    <task log="false" alias="test" interval="60" url="hhttp://localhost/umbraco/test.ashx?scheduler=true"/>
  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jun 29, 2010 @ 15:46
    Ismail Mayat
    0

    Guys,

    Thanks for replies.  Sean nice suggestion but someone can easily fake that as well. Shannon i'm thinking i can check if request is being made from same host then i can assume scheduler is doing it?   

    Regards

    Ismail

  • Alex Norcliffe 222 posts 287 karma points
    Jun 29, 2010 @ 16:24
    Alex Norcliffe
    2

    Ismail, you could check if it comes from the same host but beware if you move to / are already running on multiple web nodes in which case the host of the referrer could change.

    Alternatively, is there any chance you could just setup a ghost reference to the .ashx (e.g. using UrlRewriting or just a duplicate entry in your web.config file) which is only used by (and known to) the scheduling config? That way you know that ashx call is a scheduled call, anything else is manual

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jun 29, 2010 @ 17:33
    Ismail Mayat
    0

    Alex,

    I did the same host thing but will keep your warning in mind. Really like the ghost suggestion. 

    Regards

    Ismail

  • Greg Fyans 140 posts 342 karma points
    Aug 22, 2012 @ 16:36
    Greg Fyans
    0

    Hi guys,

    Is it still the case that the scheduled task runs as an anonymous user in 4.8.1? I want to call a /Base method and it would be great if I could set the allowGroup or allowType properties on the RestExtensionMethod attribute.

    Cheers,
    Greg. 

Please Sign in or register to post replies

Write your reply to:

Draft