سؤال

In my ASP.NET web application and there is one function will consume a lot server resources. When running this function, i would like to temporary disallowed user to access to certain page and redirect user to a alert page to inform them come back later. When this function is completed, users will allowed to access all pages. Is there any way i can do this?

هل كانت مفيدة؟

المحلول

In the page you do not won't to get user access simply write this line of code under page_Load

Response.Redirect("Thealertpage.aspx");

Then in your alert page place your message to the users and a button to redirect somewhere else in your website using the same line above but with a different page link. Alternatively, just remove the page and name the warning page as per the removed page.

I was also considering to suggest you to use a session variable to be set in your admin page by a check box but you would need to save the checkbox status in the db. Too over designed for something temporary like in your case.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top