asp.net mvc 5 - Azure Website with background task using WebClient to call controller/action on same website gets 403 -
asp.net mvc 5 - Azure Website with background task using WebClient to call controller/action on same website gets 403 -
i have background tasks run on asp.net mvc ecommerce website. 1 uses webclient phone call controller/action html shipping email notification.
i shifting website windows server, azure hosted website, or azure web app. web app using standard mode.
the problem is, on azure 403 error whenever seek , phone call client.uploadvalues in code sample below:
using (cookieawarewebclient client = new cookieawarewebclient()) { //authenticate var logincredentials = new namevaluecollection { [credentials here] }; //perform authentication - after has been performed //the cookie stored within web client client.uploadvalues(loginuri, "post", logincredentials); .... } this code worked fine on standard windows server. if seek changing phone call uploadvalues standard downloadstring of home page (that requires no authentication) of site, 403 error still occurs if seek calling different website hosted on azure, on same server 403 error still occurs if seek running code dev environment (i.e. not on same server) , phone call azure website works fine it seems if seek , access website on same virtual server running code, there permission issues.
i have downloaded content of 403 page see if give more information, said
you not have permission view directory or page
i either need help solve issue, or there other way of getting email content razor template?
the reason why using webclient phone call action returns html email particular order, have emails coded in razor .cshtml files including _layout.cshtml template emails.
my background tasks not have active httpcontext, unable phone call own renderview methods, require active httpcontext.
i have considered using razorengine, .cshtml files filled html , url helper methods, , include calling render partial action dynamic menu email template. (there cms behind website).
i prefer if possible seek , resolve 403 issue standard mode azure web apps.
azure asp.net-mvc-5 webclient http-status-code-403
Comments
Post a Comment