Text version of the video
http://csharp-video-tutorials.blogspo...
Slides
http://csharp-video-tutorials.blogspo...
All ASP .NET Text Articles
http://csharp-video-tutorials.blogspo...
All ASP .NET Slides
http://csharp-video-tutorials.blogspo...
ASP.NET Playlist
https://www.youtube.com/playlist?list...
All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...
All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatAr...
In asp.net webforms, IsPostBack page property is used to check if the request is a GET or a POST request. If IsPostBack property returns true, then the request is POST, else the request is GET.
In asp.net mvc, use Request object's HttpMethod property to check if the request is a GET or a POST request. Let's discuss using Request.HttpMethod with an example.
1. Create a new asp.net mvc application and name MVCDemo.
2. Add HomeController using "Empty MVC controller" scaffolding template
3. Copy and paste the following code
public class HomeController : Controller
{ // Action method that responds to the GET request [HttpGet] public ActionResult Index() { ViewBag.IsPostBack = IsPostBack(); return View(); } // Action method that responds to the POST request [HttpPost] [ActionName("Index")] public ActionResult Index_Post() { ViewBag.IsPostBack = IsPostBack(); return View(); } // This method checks if a request is a GET or a POST request private bool IsPostBack() { return Request.HttpMethod == "POST"; }
}
4. Right click on the Index() action method in HomeController and select "Add View" from the context menu. Set
View name = Index
View engine = Razor
Create a strongly typed view = unchecked
Create a partial view = unchecked
Use a layout or master page = unchecked
Click Add.
5. Copy and paste the following code in Index.cshtml view.
[h3 style="font-family:Arial"] IsPosback = @ViewBag.IsPostback
[/h3]
@using (@Html.BeginForm())
{ [input type="submit" value="Submit" /]
}
Build the project and navigate to http://localhost/MVCDemo/Home/Index. Notice that when you first visit the Page, a GET request is issued and hence IsPostBack = False. Now click Submit button and notice that IsPostBack = True is displayed, as a POST request is issued upon clicking the Submit button.
asp.net core docker Part 144 How to check if the request method is a GET or a POST in MVC | |
| 82 Likes | 82 Dislikes |
| 35,960 views views | 524K followers |
| Education | Upload TimePublished on 16 Sep 2013 |
Related keywords
wcf vs web api,ado.net core,sql server management studio,webkinz,methodology definition,webadvisor,methodist careers,checklas,craigslist nj,wcf one piece,asp.net core 3,ajax players,weber grill parts,webtoon,tutorials by hugo,csharp corner,mvc design pattern,asp.net machine account,servers for minecraft,asp.net core dependency injection,ado.net tutorial,services angular,ajax ontario,methodist mychart,asp.net mvc tutorial,asp.net cos'è,csharp assembly,methodist dallas,check in yap,tutorialspoint python,sql join,services briefcase,asp.net core web api,ajax jquery,wccftech,craigslist ny,asp.net zero,csharp foreach,server memes,methodjosh,sql date format,services online,chase,serverless architecture,server resume,wcf c#,server books,tutorialspoint javascript,mvcc connect,ado.net mysql,services technologies gps,check in pegasus,checkfresh,ajax deadpool,check host,server jobs,cvs,website,mvc tutorial,costco hours,wcf service application,tutorialspoint spring,serverless,wcf soap,wcf cat,wcf test client,cool math games,method homes,services & training hse colombia sas,servicestack,citibank,asp.net core identity,sql union,ajax parking,sql database,asp.net core logging,mvconnect,asp.net guida,cunyfirst,wcf nba,csharp download,wcfi foundation,csharp online,check ne demek,wcf authentication,tutorials near me,http://asp.net,server 2019,ado.net descargar,web of dreams,chernobyl,serverminer,ajax cleaner,ado.net visual studio 2019,webassign,ado.net vs entity framework,ado.net visual studio 2017,csharp list,sql like,asp.net mvc,asp.net core tutorial,sqlite,wcfm,ajax roster,check in,mvc architecture,http://ado.net,asp.net core mvc,check up fiyatları,ajax soccer,server hosting,wcfi,ajax dish soap,capital one,server rack,checkers,tutorialspoint html,csharp interface,methodjosh banned,craigslist,webroot,tutorialspoint reactjs,ajax request,wcf dragon ball,check engine,asp.net core 2.2,tutorialspoint python 3,sql developer,webster,services transmission company sas,method man wife,sql group by,asp.net core signalr,services manager,mvc framework,ajax paving,mvc near me,methodist health system,tutorialspoint spring boot,mvc map,csharp online compiler,asp.net download,sql between,ado.net c# pdf,wcf 2019 nba,services tag dell,csharp switch,ado.net ventajas y desventajas,csharpstar,wcf tutorial,tutorialspoint,ajax meaning,csharp-video-tutorials.blogspot,tutorials dojo,csharp string format,central park 5,ado.net c#,asp.net core github,server status,ajax fc,server jobs nyc,asp.net core swagger,sql formatter,credit karma,services group,server error in '/' application,methodist,services windows,asp.net core 3.0,sql injection,wcf ria services,tutorialspoint c#,calculator,ado.net entity data model,sql insert,tutorialspoint tableau,services google play apk,check up,sqlyog,asp.net core 3 release date,sql server,method wheels,server job description,tutorials by a,servicenow,webcam,mvc hours,webmd symptom,csharp array,check in nedir,csharp enum,ajax call,asp.net core 2. guida completa per lo sviluppatore,asp.net core,server pro,server status ffxiv,webcrims,cheap flights,asp.net core hosting,services sas,method man,tutorialspoint java,tutorialspoint java compiler,webmd,csharp to json,college football,ado.net dataset,csharp dictionary,methodist university,cnn,website builder,tutorialspoint sql,asp.net web api,server side rendering,weber grills,sql server 2017,mvc nj,tutorialspoint spark,ado.net oracle,asp.net core download,csharp to vb.net,check24,webster bank,methodist hospital,methodist hospital jobs,webstaurant,checkpoint,tutorialsystems,ajax post,services fms publish announcement,services.msc no abre,ajax jersey,csharp operator,check up nedir,asp.net core razor pages,server duties,asp.net core environment variables,csharp random,century 21,services consultores,services consulting,mvcsd,check out,mvcsc,services.msc,ado.net pdf,asp.net core configuration,ajax marvel,sql update,asp.net tutorial,mvc medical,check up ücretleri,ado.net entity data model visual studio 2019,wcfs international curriculum,mvc2,ado.net entity data model visual studio 2017,checkcosmetic,chase online,wcf api,costco,server jobs near me,webex,sql meaning,sql tutorial,method acting,sql commands,ado.net entity framework,check up ankara,ajax tavern,methodist church,tutorialsteacher,ajax javascript,services desk,methodical,check in yapma,ajax greek,csharp tutorial,mvc pattern,ado.net sql server,ado.net connection,asp.net identity,mvcu,asp.net core middleware,wcf web service,method body wash,mvc webadvisor,web store,mvcc,webmail,mvci,mvctc,methodology,
Không có nhận xét nào:
Đăng nhận xét