Sirinoks 0 Posted April 10, 2019 Report Share Posted April 10, 2019 I was trying to learn Razor pages. I use Visual Studio, but I'm pretty new to it. I followed an official getting started guide for installation process - https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-2.2&tabs=visual-studio . Then I tried implementing an example of w3schools - https://www.w3schools.com/asp/razor_syntax.asp - "Reading User Input". VS seemed to not recognize it - it gave me errors. I did install and add "Microsoft.AspNetCore.Mvc.Razor" through NuGet (also tried installing version 2.1.3 and latest 2.2.0) and I also added "using Microsoft.AspNetCore.Mvc.Razor;" to the Startup.cs - still nothing. Maybe I need to connect it somehow? Visual studio 2017 | ASP .NET Core 2.1 Please help! Quote Link to post Share on other sites
Funce 42 Posted April 10, 2019 Report Share Posted April 10, 2019 I just had a poke around. The tutorials use ASP.NET Web Pages 3.2 apparently. ASP.NET Core 2.1 may require something a little different. Instead of ifPost (which looks like its erroring too) try if (HttpMethods.IsPost(Request.Method)) In terms of the Request stuff, try something like this var num1 = Request.Form["text1"]; var num2 = Request.Form["text2"]; Quote Link to post Share on other sites
Sherin 1 Posted February 12, 2020 Report Share Posted February 12, 2020 If you use aspnetcore then pass its Httpmethods calls and after Ispost calls and you pass this method the parameter pass in IsPost method is request.method @{ if(HttpMethods.IsPost(Request.Method)) { var num1=Request.Form["text1"]; var num2 = Request.Form["text2"]; } } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.