Forum Discussion

  • Abhishek_Khatri's avatar
    Abhishek_Khatri
    Copper Contributor
    I will check but where is the link, the link you provide its localhost its now working in my side
    can you please provide link of code anything that help me to resolve your problem.

    Thanks
    • rmerritt's avatar
      rmerritt
      Copper Contributor

      Abhishek_Khatri 

       

      Sorry this is just local on my laptop:

       

       

      I have Survey.cshtml:

      @page "/Survey"
      @model SWAT2022.Views.Home.Index1Model
      @{
          ViewData["Title"] = "Test";
      }
      
      <h1>Hello, world!</h1>
      <h2>The time on the server is @DateTime.Now  LAT:@Model.Long  LONG:@Model.Lat </h2>

      and the cs Survey.cshtml.cs:

      using Microsoft.AspNetCore.Mvc;
      using Microsoft.AspNetCore.Mvc.RazorPages;
      
      namespace SWAT2022.Views.Home
      {
          public class Index1Model : PageModel
          {
              public string? Lat { get; set; }
              public string? Long { get; set; }
              public void OnGet()
              {
                  Lat = Request.Query["Lat"]; ;
                  Long = Request.Query["Long"]; ;
              }
          }
      }


      I must have a fundamental misunderstanding of RazorPages as I get this error now:

      Any Idea how I can integrate this Razor into my project

      • Abhishek_Khatri's avatar
        Abhishek_Khatri
        Copper Contributor
        Can I get the code Then I will review and provide you a full guidance if possible
        Thanks

Resources