I want to give web API to the user fro particular time only such as if I give the hosted link of web API to the client then it should be accessed for 15 days only for that, I have Added startDate and EndDate Column in my Registration table whenever the user logged in the date of logged in gets save in database I will define EndDate Manually in database
- [HttpPost]
- public void PostInsertDate([FromBody]ExpoRegistration ExpoRegistration)
- {
-
- Big5OnlinePortalEntities db = new Big5OnlinePortalEntities();
- var date = db.ExpoRegistrations.FirstOrDefault(e => e.UserName == ExpoRegistration.UserName && e.Password == ExpoRegistration.Password);
- if (date.StartDate == null)
- {
- date.StartDate = DateTime.Today.Date;
- DateTime edate = date.StartDate.Value.AddDays(15);
- date.EndDate = edate;
- db.SaveChanges();
- Request.CreateResponse(HttpStatusCode.OK, date);
- }
- else
- {
- Get();
-
-
- }
- if (date.StartDate >= date.EndDate)
- {
- Request.CreateErrorResponse(HttpStatusCode.NotFound, "Customer not found");
- }
- else
- {
- Get();
-
-
-
- }
- }
- public HttpResponseMessage Get()
- {
- var response = Request.CreateResponse(HttpStatusCode.Found);
- response.Headers.Location = new Uri("http://localhost:64995/Data.html");
- return response;
- }
- }
In above code, everything is working well. The problem is with redirect of page data.html
why it is not redirecting to it
Thanks!!