You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET 2017 C# Web应用URL优化后出现浏览器卡顿错误求助

Fixing the "Webpage slowing down browser waiting for csi.gstatic.com" Issue After URL Routing Optimization

Hey there! Let's tackle this problem step by step—since you just updated your ASP.NET routing to clean up URLs and have AngularJS integrated, the issue is almost certainly tied to a conflict between server-side routing, client-side Angular routing, or a misbehaving Google-related service triggered by the route changes.

1. First: Resolve ASP.NET & Angular Routing Conflict

When you switched to mydomain.com/Doctor/XX, you need to ensure your server doesn’t try to resolve this as a physical controller/action. Since it’s an Angular single-page app, the server should always return your main entry page (usually Home/Index) so Angular can handle the client-side routing.

Update your ASP.NET Route Configuration

In RegisterRoutes, adjust your map route to point to your main Angular entry point (make sure this route is registered before the default one to avoid overrides):

routes.MapRoute(
    name: "DoctorRoute",
    url: "Doctor/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

// Default route should be last
routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

Configure AngularJS Client-Side Routing

Use Angular’s $routeProvider (or ui-router if you’re using it) to handle the /Doctor/:id path, and always use Angular’s routing directives for links to avoid full page reloads:

angular.module('yourAppName', ['ngRoute'])
.config(function($routeProvider) {
    $routeProvider
    .when('/Doctor/:id', {
        templateUrl: 'templates/doctor-detail.html',
        controller: 'DoctorDetailController'
    })
    .otherwise({ redirectTo: '/' });
});

For links, replace plain href with ng-href to let Angular handle navigation without reloading the entire page:

<a ng-href="/Doctor/{{doctor.id}}">View Doctor Details</a>

Full page reloads can trigger unnecessary requests to Google services, leading to the slowdown.

2. Diagnose the csi.gstatic.com Request

csi.gstatic.com is linked to Google services like Google Analytics (GA), Google Fonts, or reCAPTCHA. Here’s how to fix common issues:

If it’s Google Analytics

Single-page apps need manual GA page tracking—otherwise, GA might not handle route changes correctly, leading to stuck requests. Add this to your Angular run block:

angular.module('yourAppName').run(function($rootScope, $location) {
    $rootScope.$on('$routeChangeSuccess', function() {
        // Only run if GA is loaded
        if (window.ga) {
            ga('send', 'pageview', $location.path());
        }
    });
});

If it’s Google Fonts

Check if you’re loading Google Fonts correctly. If the request is stuck, try:

  • Using a different CDN for fonts
  • Downloading the fonts locally and serving them from your server
  • Verifying there are no typos in the font embed link

3. Debug with Browser DevTools

Open your browser’s DevTools (F12) to pinpoint the root cause:

  • Go to the Network tab: Watch for the csi.gstatic.com request—check if it’s stuck in "pending" or "stalled". Look at the "Initiator" column to see which script is triggering it.
  • Go to the Console tab: Look for Angular errors, 404s, or JS exceptions—these can cause resource leaks that slow down the browser, compounded by the stuck Google request.

4. Test by Disabling Google Services (Temporarily)

Comment out any Google-related scripts (GA, Fonts, etc.) from your page and test the route again. If the slowdown disappears, you’ve confirmed the issue is tied to that service—then you can focus on fixing its integration with your Angular SPA.


内容的提问来源于stack exchange,提问作者Mahsa Hassankashi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:47:18