I have a page which has function behind run about for 4 to 5 minutes. So I want to let the user click to other pages if they do not want to wait for the page. Which means I need to stop the page loading. I googled and found there is a StopLoading function in .Net. MSDN StopLoading However it seems only support in .Net4. I am using .Net 4.5. Any substitution in .Net 4.5 that can stop the page loading and is there exist a way to stop the page loading and go to other aspx?
Asked
Active
Viewed 36 times
0
-
4.5 is meant to be backwards compatible to 4.0. So in theory anything that's in 4.0 will be available in 4.5 as well. But it's not clear how you think it's relevant to a webpage anyway – ADyson Jul 10 '18 at 09:43
-
1`System.Windows.Navigation` usually used in WinForms/WPF (CMIIW). Use `Response.End()` in ASP.NET to stop page load (see [here](https://stackoverflow.com/questions/5000894/how-can-i-stop-an-asp-net-website-from-loading-depending-on-a-certain-condition)). – Tetsuya Yamamoto Jul 10 '18 at 09:44
-
That function is in "System.Windows.Navigation" you have tagged your question "asp.net" These two things are ... not mutually inclusive. – ta.speot.is Jul 10 '18 at 09:44
-
How can I stop the first page loading function by Response.End() if I click another aspx page? – want_to_be_calm Jul 10 '18 at 09:48
-
I would suggest to google a bit more. As others have said you cannot mix desktop code (winforms) with asp.net code (asp.net) – Cleptus Jul 10 '18 at 09:49
-
@want_to_be_calm How you "click" a page in question to stop page loading on another? Note that the `Page_Load` method runs server-side, use redirection (`Response.Redirect`) if you want to let users redirect from current page. – Tetsuya Yamamoto Jul 10 '18 at 09:57
-
Thanks @TetsuyaYamamoto here is the link
– want_to_be_calm Jul 10 '18 at 10:00 -
Should I add Response.Redirect in the link? – want_to_be_calm Jul 10 '18 at 10:13
-
you can't put response.redirect in a link, as mentioned it's a _server-side_ method. Anyway it's not clear what the issue is. If a user is using a web browser, they have full control of the navigation. They can click away from the current page whenever they like, by using the forward / back buttons, typing a new URL, closing the window, or clicking on any links which the browser may have rendered into the window. Whether the page is still loading or not is not relevant to that. – ADyson Jul 10 '18 at 10:42
-
However if you have something which is taking 5 minutes to load you need to take a serious look at your code's performance. Why does it take so long to run? Is it JavaScript code or C# code? Is it 100% necessary? Can it be moved it to some kind of background process and executed offline? I feel like you're trying to fix the symptom instead of the cause. – ADyson Jul 10 '18 at 10:43
-
It’s a page loading data to dashboard. User need to wait to see the data. And I click other link in the web page, it took a while to the other link. – want_to_be_calm Jul 10 '18 at 10:47
-
And....that answers almost none of my questions. If you would like some further help, please respond accordingly. Thankyou. – ADyson Jul 10 '18 at 11:01
-
Is that I make the loading function run in background process. Then the switching of pages will not be more fast? – want_to_be_calm Jul 12 '18 at 08:54