TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nagma Khan
NA
126
22.8k
how to redirect to html page in my web api post method
Oct 24 2017 7:36 AM
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)
{
//string remoteUrl = "http://localhost:64995/Data.html";
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();
//Redirect(remoteUrl);
//Request.CreateErrorResponse(HttpStatusCode.NotFound, "Customer not found");
}
if
(date.StartDate >= date.EndDate)
{
Request.CreateErrorResponse(HttpStatusCode.NotFound,
"Customer not found"
);
}
else
{
Get();
//Redirect(remoteUrl);
//var response = new HttpResponseMessage(HttpStatusCode.Redirect);
//response.Headers.Location = new Uri("http://localhost:64995/Data.html");
}
}
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!!
Reply
Answers (
1
)
I want to fill dropdownlist from database in html page
Amadeus WebServices ...