{"id":16686660,"url":"https://github.com/alexinea/dotnet-url-rewrite-examples","last_synced_at":"2026-04-28T14:02:29.131Z","repository":{"id":143428236,"uuid":"85644410","full_name":"alexinea/dotnet-url-rewrite-examples","owner":"alexinea","description":"URL Rewrite Samples","archived":false,"fork":false,"pushed_at":"2017-04-24T08:06:41.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-31T00:35:52.842Z","etag":null,"topics":["rewrite"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexinea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-21T01:19:52.000Z","updated_at":"2021-12-17T18:28:11.000Z","dependencies_parsed_at":"2023-07-05T08:00:36.115Z","dependency_job_id":null,"html_url":"https://github.com/alexinea/dotnet-url-rewrite-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexinea/dotnet-url-rewrite-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexinea%2Fdotnet-url-rewrite-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexinea%2Fdotnet-url-rewrite-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexinea%2Fdotnet-url-rewrite-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexinea%2Fdotnet-url-rewrite-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexinea","download_url":"https://codeload.github.com/alexinea/dotnet-url-rewrite-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexinea%2Fdotnet-url-rewrite-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32383791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rewrite"],"created_at":"2024-10-12T15:06:32.903Z","updated_at":"2026-04-28T14:02:29.094Z","avatar_url":"https://github.com/alexinea.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASP.NET UrlWrite 样例\n\n### 问题\n\n现有 `pc` 和 `mobile` 两文件夹（其文件夹内的结构也不同），根据用户的设备类型自动选择显示 pc 版或 mobile 版。\n\n\u003e **推荐**：使用栅格化的自适应设计让页面自动适应不同设备，以避免本模块造成的性能损失。\n\n***\n\n### ASP.NET URL Rewrite\n\n项目：`src\\UrlWrite.AspNet`\n\n**仅可用于 IIS 7+**\n\n`web.config` 的改动：\n\n在 `system.webServer:modules` 内增加配置：\n\n```\n\u003cadd name=\"UrlRewriter\" type=\"UrlRewrite.AspNet.HttpMoudle.UrlRewriteModule\" /\u003e\n```\n\n在 `system.webServer:handlers` 内增加配置：\n\n```\n\u003cremove name=\"ExtensionlessUrlHandler-ISAPI-4.0_32bit\" /\u003e\n\u003cremove name=\"ExtensionlessUrlHandler-ISAPI-4.0_64bit\" /\u003e\n\u003cremove name=\"ExtensionlessUrlHandler-Integrated-4.0\" /\u003e\n\u003cremove name=\"Rewriter-32\" /\u003e\n\u003cremove name=\"Rewriter-64\" /\u003e\n\u003cadd name=\"ExtensionlessUrlHandler-ISAPI-4.0_32bit\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" responseBufferLimit=\"0\" /\u003e\n\u003cadd name=\"ExtensionlessUrlHandler-ISAPI-4.0_64bit\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_isapi.dll\" preCondition=\"classicMode,runtimeVersionv4.0,bitness64\" responseBufferLimit=\"0\" /\u003e\n\u003cadd name=\"ExtensionlessUrlHandler-Integrated-4.0\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" type=\"System.Web.Handlers.TransferRequestHandler\" preCondition=\"integratedMode,runtimeVersionv4.0\" /\u003e\n\u003cadd name=\"Rewriter-32\" path=\"*\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" /\u003e\n\u003cadd name=\"Rewriter-64\" path=\"*\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" preCondition=\"classicMode,runtimeVersionv4.0,bitness64\" /\u003e\n```\n\n推荐阅读：\n\n+ [Bikeman868/UrlRewrite.Net](https://github.com/Bikeman868/UrlRewrite.Net)\n\n***\n\n### ASP.NET Core URL Rewrite\n\n项目：`src\\UrlRewrite.AspNetCore`\n\nNuGet 安装：\n\n```\nPM\u003e install-package Wangkanai.Responsive -pre\n```\n\n在 `ConfigureServices` 方法中配置：\n```\nservices.AddResponsive()\n        .AddViewSuffix()\n        .AddViewSubfolder();\n```\n\n在 `Configure` 方法中使用中间件：\n```\napp.UseResponsive();\n```\n\n`ASP.NET Core Responsive` 会根据你设备的种类调用不同的视图：\n\n+ 如果使用的是 `AddViewSuffix()`，则路径形如 `views/[controller]/[action]/index.mobile.cshtml` \n+ 如果使用的是 `AddViewSubfolder（）`，则路径形如 `views/[controller]/[action]/mobile/index.cshtml`\n\n推荐阅读：\n\n+ [URL Rewriting Middleware in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting)\n+ [ASP.NET Core Responsive](https://github.com/wangkanai/Responsive)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexinea%2Fdotnet-url-rewrite-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexinea%2Fdotnet-url-rewrite-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexinea%2Fdotnet-url-rewrite-examples/lists"}