Can we use JsonRequestBehavior.AllowGet with [HttpPost] attribute?

Can we use JsonRequestBehavior.AllowGet with [HttpPost] attribute?

Content Index :

Can we use JsonRequestBehavior.AllowGet with [HttpPost] attribute?
Tag : chash , By : Ian
Date : January 12 2021, 08:33 AM

around this issue Adding the JsonRequestBehavior.AllowGet parameter to your return Json has no use since your method is decorated with [HttpPost] so it can't be called using the GET verb.
You say that sometimes your system "hits with get and sometimes with post" but if you try to call this method using a GET request the routing system will most likely get a 404.

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

What 'sensitive information' could be disclosed when setting JsonRequestBehavior to AllowGet

Tag : asp.net-mvc , By : DarrenBeck
Date : March 29 2020, 07:55 AM
Hope that helps Say your website has a GetUser web method:
{ "Name": "John Doe" }
<script src="http://www.example.com/User/GetUser/32"></script>

To allow GET requests, set JsonRequestBehavior to AllowGet

Tag : asp.net-mvc , By : user187383
Date : March 29 2020, 07:55 AM
wish helps you I have bound bulk records in a Kendo UI grid. The response is returned from Json. , You have simple typo/syntax error
return Json(new { total = total, data = data,JsonRequestBehavior.AllowGet });
return Json(new { total = total, data = data }, JsonRequestBehavior.AllowGet);

JsonRequestBehavior.AllowGet does not work with HttpGet

Tag : asp.net , By : Steve O.
Date : March 29 2020, 07:55 AM
help you fix your problem A 404 (Resource not found) means the method is not found (and has nothing to do with JsonRequestBehavior).
Change your ajax to use
    url: "/Home/Create", // note leading forward slash

Security concerns for JsonRequestBehavior.AllowGet when using AJAX to get JSON

Tag : javascript , By : uxn
Date : March 29 2020, 07:55 AM
will be helpful for those in need Check this post: Why is JsonRequestBehavior needed?
Excerpts from original post:

How to set JsonRequestBehavior.AllowGet with return JsonResult

Tag : json , By : glisignoli
Date : March 29 2020, 07:55 AM
will help you Just see the options available inside the JsonResult you will find the JsonRequestBehavior and set that as an allowget.
return new JsonResult()
            Data = mydatalist,
            MaxJsonLength = Int32.MaxValue,
            JsonRequestBehavior = JsonRequestBehavior.AllowGet
Related Posts Related QUESTIONS :
  • Print a Winform/visual element
  • C# logic order and compiler behavior
  • When to use an extension method with lambda over LINQtoObjects to filter a collection?
  • How to make a button appear as if it is pressed?
  • C# and Arrow Keys
  • How do you resolve a domain name to an IP address with .NET/C#?
  • Should the folders in a solution match the namespace?
  • How can I evaluate C# code dynamically?
  • CSharpCodeProvider Compilation Performance
  • How can I create Prototype Methods (like JavaScript) in C#.Net?
  • DataTable Loop Performance Comparison
  • CSV string handling
  • What is the best way to do unit testing for ASP.NET 2.0 web pages?
  • High availability
  • What to use for Messaging with C#
  • Accessing a Dictionary.Keys Key through a numeric index
  • ConfigurationManager.AppSettings Performance Concerns
  • What Are Some Good .NET Profilers?
  • Is this a good way to determine OS Architecture?
  • How to create a tree-view preferences dialog type of interface in C#?
  • Searching directories for tons of files?
  • Can I have a method returning IEnumerator<T> and use it in a foreach loop?
  • Why can't I have abstract static methods in C#?
  • Displaying ad content from Respose.WriteFile()/ Response.ContentType
  • Convert integers to written numbers
  • Absolute path back to web-relative path
  • How can we generate getters and setters in Visual Studio?
  • Bringing Window to the Front in C# using Win32 API
  • Possible to "spin off" several GUI threads? (Not halting the system at Application.Run)
  • Reading a C/C++ data structure in C# from a byte array
  • How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox?
  • Setting Objects to Null/Nothing after use in .NET
  • Converting ARBG to RGB with alpha blending
  • Is it better to create Model classes or stick with generic database utility class?
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • c# wpf | create complex object with user-defined name to Serialize into JSON
  • How can I get a instance of a generic list with reflection?
  • WPF XAML - Design time and visibility of textbox
  • EF Core and MySql query is too slow
  • Getting Registered App Display Name from an App Id
  • How to get all variables from a string
  • Delete entity with all childs connected
  • Azure Build agent cant´t find class library referance
  • Initialize Nested Dictionaries in c#
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com