Avoid 401 Redirect to login on custom page

Hi

I created custom page:
controller.AddRaw("page1", "page1", null, getParameterConstraints, Page1.ProcessRequest, caseOptions);

In Page1.ProcessRequest on some cases I return StatusCode=401 (Unauthorized), but on browser user receive code 302 (redirect)  and html (Object moved to here.)

public static void ProcessRequest(HttpContextBase context, PageContext pageContext) {

.....
context.Response.StatusCode = 401;
context.Response.ContentType = "text/plain";
context.Response.Output.Write("Unauthorized!");
context.Response.End();
}

Can I avoid that redirect and return user code and message as is?

Parents Reply Children
No Data