## c# – Ajax POST desde Area en .NET MVC devuelve 403 Acceso Denegado

Estoy realizando una petición POST utilizando Ajax que funciona correctamente en mi Localhost pero la misma devuelve el error 403 Forbidden – Acceso Denegado en el Servidor.
Me contacté con los Administradores del Server y después de 12 largos días me dijeron que no encuentran un error o falta de permisos.

Extrañamente hago OTRA petición (NO desde un Área) y funciona correctamente. Dejo ambas peticiones:
(También probé hacer la petición que funciona desde el Área y funciona)

Funcional:

``````\$(document).ready(function () {
\$.ajax({
url: "@Url.Action("GetNombre","Usuarios", new { Area = "" })",
type: "POST",
success: function (foo) {
\$(".foo-class").html('Hola, ' + foo.nombre + '!');
}
});
});
``````

NO Funcional (Devuelve 403):

``````\$("form").submit(function (e) {
e.preventDefault();

var lstContacto_Clientes = ();

\$("div(id*='contacto-')").each(function () {
......
});

//Datos Cliente
var Cliente = {
......
}

\$.post({
url: "@Url.Action("Crear", "Clientes")",
method: "POST",
data: {
oClienteView: Cliente,
lstContactoClientes: lstContacto_Clientes
},
success: function (result) {
.....
},
error: function (e) {
console.log('JSON Error');
console.log(e);
}
});

});
``````

Este es el Routing del Area(Por eso no aclaro el Área en el Url.Action de arriba):

``````    context.MapRoute(
new { controller = "AdminPanel", action = "Index",  id = UrlParameter.Optional }
);

context.MapRoute(
new { controller = "AdminPanel", action = "Index", id = UrlParameter.Optional }
);
``````

Subidivsion de Carpetas:

Por último, el Controlador Clientes está afectado por los siguientes Filtros de Autorización:

``````
public class AutorizacionRolesAttribute : AuthorizeAttribute
{
public AutorizacionRolesAttribute(params string() roles)
{
//De AutorizacionRoles(Roles="") recibe los valores de -Roles=""- y los guarda en un array de strings
this.allowedroles = roles;
}
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
bool authorize = false;
//Recibe el ID del Usuario por la sesion
int? userId = (int?)httpContext.Session("SessionId");
var token = httpContext.Session("token");

//Chequea solamente si recibe UNICAMENTE el param "Token", ningun otro
//asi se chequea en la accion "Crear" si está habilitado
if (allowedroles(0) == "Token")
{
//Si NO esta vacio, devuevle TRUE
if(token != null)
return true;
}
//Chequea si userId es valido
if (userId > 0 && userId != null)
using (var db = new PBIEntities())
{
//Recibe el Rol del Usuario
var userRole = (from u in db.Usuarios
join r in db.Roles on u.rol equals r.ID_Rol
where u.id_usuario == userId
select new
{
r.Rol
}).FirstOrDefault();

//Chequea que el Rol del Usuario esté habilitado recorriendo allowedroles
foreach (var role in allowedroles)
{
if (role == userRole.Rol) return true;
}
}

return authorize;
}

protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary
{
{ "controller", "Home" },
{ "action", "Index" },
{ "Area", "" }
});
}
}
``````
``````    public class AutorizacionSesion : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var sessionId = HttpContext.Current.Session("SessionId");

var token = HttpContext.Current.Session("token");

//Si NO hay sesion
if(sessionId == null)
{
//Si hay Token
if (token != null)
{
//Si el Controller es distinto de Usuarios
if (filterContext.Controller is UsuariosController == false)
{
}
} else {
//Si el Controlador es Distinto de Usuarios
if (filterContext.Controller is UsuariosController == false)
{
}
}
}

base.OnActionExecuting(filterContext);
}
}

``````

## probability – On drawing there’s standardized normal distribution density diagram. Which formulas express value of area field colored wtih green?

a) $$int_{2}^{-1}Phi (x)dx$$, $$Phi$$ – distribution $$N(0,1)$$

b) $$int_{2}^{-1}frac{1}{sqrt{2pi}}e^{^{frac{-x^{2}}{2}}}dx$$

c) $$frac{1}{sqrt{2pi}}e^{^{frac{-1^{2}}{2}}}+frac{1}{sqrt{2pi}}e^{^{frac{2^{2}}{2}}}$$

d) $$Phi(2)+Phi(1)-1$$, $$Phi$$ – distribution $$N(0,1)$$

e) $$Phi(2)+Phi(1)-1$$, $$Phi$$ – distribution $$N(0,1)$$

So its Gaussian distribution with parameter $$(-1,2)$$

Formula for depth:
$$f(x)=frac{1}{sigma sqrt{2pi}}e^{^{frac{-(x-mu )^{2}}{2sigma^{2}}}}$$
, $$mu in R, sigma>0$$

I don’t really understand this, I would bet on c) since it has pow $$-1$$ and $$2$$,

$$e^{^{frac{-1^{2}}{2}}}$$ + $$e^{^{frac{2^{2}}{2}}}$$ which are parameters of this distribution…

But there might be more then 1 correct answer so I am not sure.

## r – Error al calcular el área descrito por varios puntos en el mapa

Estoy intentando calcular que describen varias coordenadas (abajo descritas). Para ello uso el siguiente código

`````` library(sf)

Code Latitude Longitude
C1    40.051302   -3.593308
C2    40.043193   -3.599064
H1    40.04933    -3.477574
H2    40.085899   -3.214026
H3    40.245852   -3.253943
M1    40.03184    -3.34522
M1    40.03184    -3.34522
M2    40.050578   -3.50304
M3    40.0459 -3.125
M4    40.032298   -3.182801
Z1    40.050052   -3.476076
Z2    40.04472    -3.131
L1    40.03185    -3.3453
L2    40.048758   -3.476462
L3    40.050352   -3.125794
L4    40.245459   -3.252617
Q1    39.59552    -3.39183
Q2    40.225155   -3.530613
Q3    40.320294   -3.205903
Q4    40.345348   -3.137145
E1    40.059138   -3.500323
E2    40.234966   -3.536191
E3    40.089637   -3.196057
E4    40.494167   -3.131139")

tbl(, c(3,2)) %>%
as.matrix() %>%
list() %>%
st_polygon() %>%
st_sfc() %>%
st_set_crs(4326) %>%
st_area()
``````

pero obtengo el siguiente error:

`````` Error in MtrxSet(x, dim, type = "POLYGON", needClosed = TRUE) :
polygons not (all) closed
``````

¿Cómo se puede solucionar el error o que alternativas hay?

Gracias de antemano

## multivariable calculus – Area of one leaft of Rose curve

Evaluation of shaded area of leaf of curve $$r=cos(2theta)$$

What i try: Area of leaf of curve

$$=frac{1}{2}int^{beta}_{alpha}r^2dtheta$$

$$=frac{1}{2}int^{frac{3pi}{4}}_{frac{5pi}{4}}cos^2(2theta)dtheta=frac{1}{4}int^{frac{5pi}{4}}_{frac{3pi}{4}}2cos^2(2theta)dtheta$$

$$=frac{1}{4}int^{frac{5pi}{4}}_{frac{3pi}{4}}bigg(1+cos(4theta)bigg)dtheta=frac{pi}{8}$$
Can anyone please tell me is my process is right and also tell me is my upper and lower limit is right or not. If not Then please correct me. Thanks

## dnd 5e – Can creatures move through the area of the Hunger of Hadar spell on the Z axis?

I’m unclear on what you’re asking, to be honest. The description of the hunger of Hadar spell says (PHB, p. 251):

You open a gateway to the dark between the stars, a region infested with unknown horrors. A 20-foot-radius sphere of blackness and bitter cold appears, centered on a point with range and lasting for the duration. This void is filled with a cacophony of soft whispers and slurping noises that can be heard up to 30 feet away. No light, magical or otherwise, can illuminate the area, and creatures fully within the area are blinded.

The void creates a warp in the fabric of space, and the area is difficult terrain. Any creature that starts its turn in the area takes 2d6 cold damage. Any creature that ends its turn in the area must succeed on a Dexterity saving throw or take 2d6 acid damage as milky, otherwordly tentacles rub against it.

Maybe you’re focusing too much on the word “gateway” in the first sentence?

Apart from the “difficult terrain” part of the spell, there is nothing in the description that limits movement, particularly in any one axis.

## The DM decides how high Evard’s Black Tentacles can reach (and 0 feet is a valid ruling)

The text of Evard’s Black Tentacles says (emphasis added):

Squirming, ebony tentacles fill a 20-foot square on ground that you can see within range. For the duration, these tentacles turn the ground in the area into difficult terrain.

So the wording of the spell clearly specifies that it affects an area on the ground. For creatures running around on the ground, it is easy enough to determine whether they are in the area: if they set foot on the affected ground, they have entered the spell’s area. For creatures flying “at ground level”, i.e. occupying 5-foot cubes at the same level as non-flying creatures, the situation is a bit more ambiguous: obviously the tentacles must have some length in order to grab onto anything, but it’s unclear how long they are or how far up they can reach, by RAW. Notwithstanding the portrayal of the spell in most art, it’s entirely possible for the spell’s effects to be caused by knee-high tentacles, or perhaps long tentacles that writhe across the ground until they find a creature to climb up onto.

I tried to find some guidance in the other surface-affecting spells, but the only other spells I could find that specifically affect a surface rather than a 3-dimensional area are Entangle, Grease, and Earthquake. Of these, Entangle is no help, since it has a wording very similar to Black Tentacles, complete with the exact same ambiguity about height. Grease and Earthquake, by their natures, unambiguously affect only creatures in contact with the ground, but not for reasons that provide any guidance for Black Tentacles or Entangle. So ultimately, it’s up to the DM to decide how high the tentacles can reach, because the spell doesn’t specify.

## Were the creatures actually flying?

As Mark Wells points out in the comments, just because a creature has a fly speed doesn’t mean that creature is continuously flying. Especially if the creature flies using wings (as opposed to levitation or some other means), flying takes energy, and the wingbeats might make a lot of noise. A typical flying creature probably wouldn’t be flying while holding a conversation on the ground. And if these creatures were hovering just above the ground instead of standing, ideally your DM should have mentioned that when describing the scene.

It’s possible that your DM didn’t know you had a spell that (maybe) only affects creatures on the ground, and so they didn’t know that detail was important, in which case it would be good to give the DM the benefit of the doubt. It’s also possible that your DM thought the spell was “cheap” and was looking for any excuse to wheedle out of it. I don’t know your DM, so I can’t tell you which it is.

## macrodroid – Make a pop up message if about to call area codes excluding specified

So I wanted a pop up message/dialog box to appear whenever I dial/call number with prefixes excluded from my list.

To clarify, there are two codes. One is the country code and the other is the network code. For instance, country code is `+63` and network (company) code is `945`. Country code is only one. While network code reaches like a hundred. I want a pop up message to appear when the prefix is other than `+63945*`, `+63917*`, `+63906*`, and 20+ other numbers. In other words, there would be no pop up when the prefixes I set are being dialled/called while every other number would prompt a pop up message.

I used this macro but all the numbers I dial seem to activate the dialog box. The macro is working but there seems to be an error somewhere.

(Click to enlarge the images)

## Macrodroid: Convert “+63” area code to “0”

So there is already a working macro that does the following:

Whenever I dial/call a number with a prefix other than the ones I specified, a dialog box appears. I wanted to “filter” the numbers so I would be notified if I was to make a call to a number belonging to a different network/company.

To clarify, there are two codes in the prefix. One is the country code and the other is the network code. For instance, country code is +63 and network (company) code is 945. Furthermore, the country code +63 is interchangeable with 0 and both valid are when making a call. So a +63945xxx number is the same as 0945xxx.

My current issue is that 4-digit prefixes (the ones starting with 0 like 0945, 0917, etc) are already “filtered” by the existing macro. However, 6-digit prefixes (the ones starting with +63 like +63945,+63917 are not filtered), hence 0945 and +63945 which are virtually the same will get different responses (One will prompt a dialog box and the other will not). What I am looking for is a way to first convert +63 to 0 so that it becomes a 4-digit number which the macro can filter.

Here is a link to my previous question which can be used as reference.

Macrodroid: Make a pop up message if about to call area codes excluding specified

Also attached is the macro that currently filters 4-digit prefixes but overlooks 6-digit ones. (!(macro)(1))(1)
(1): https://i.stack.imgur.com/9N7pn.png

## Macrodroid: Make a pop up message if about to call area codes excluding specified

I want a pop up message to appear when I call numbers with area codes outside of the the ones I specify. How could I do this Macrodroid? Thanks in advance.

## pathfinder 1e – Does moving a grappled foe through someone’s threatened area trigger an attack of opportunity?

If one has grappled a foe, and then succeeds on a check to maintain it, one of the options is:

You can move both yourself and your target up to half your speed. At the end of your movement, you can place your target in any square adjacent to you. If you attempt to place your foe in a hazardous location, such as in a wall of fire or over a pit, the target receives a free attempt to break your grapple with a +4 bonus.

The attack of opportunity (AoO) rules state that:

Moving out of a threatened square usually provokes attacks of opportunity from threatening opponents. There are two common methods of avoiding such an attack—the 5-foot step and the withdraw action.

1. Does being moved out of a threatened square by someone else (in general, or while grappled) triggers an AoO?
2. If it does, would that trigger the “if you attempt to to place your foe in a hazardous location” clause?