I work on razor page asp.net . I face issue my issue values on get reset after click submit button so when click submit button and check values on POST I found it become null
so How to avoid this behavior OR with another meaning how to retain values on get without reset when click submit button
from my debug details as below
1 - when page load i check user id it have value 9595
public void OnGet() { string MyUserData = Request.Cookies["myUserData"]; UserAuthResponse? userAuthResponse = System.Text.Json.JsonSerializer.Deserialize<UserAuthResponse>(MyUserData); string UserID = userAuthResponse.Data.UserID; }
2 - Now I will click submit button so break point hit on post method
public async Task OnPost(UC.ADC.Core.Entities.SQL.Branch branch) { //userAuthResponse.Data.UserID become null }
when check values of userAuthResponse.Data.UserID it become null
userAuthResponse.Data.UserID
so how to preserve or retain value of userAuthResponse.Data.UserID after make get to use it on post method
form view as below :
<form method="post"> <div class="form-group row" style="margin-left:200px;font-size:15px;font-family: 'Open Sans' , sans-serif;font-weight: bold;"> <button type="submit" class="col-sm-1 btn btn-primary">Submit</button> </div> </form>
issue debug details as below :