Asp.Net中的URL问题 [英] URL Question In Asp.Net

查看:81
本文介绍了Asp.Net中的URL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我对Facebook网址有疑问
您会看到www.facebook.com/[ProfileName]
Facebook如何做到这一点?
我的意思是ProfileName是动态名称
如何在ASP.NEt(C#)中创建它?
是子域还是文件夹?如果它们是如何在没有子域或文件夹的情况下创建的?
非常感谢

hello
I have a question about facebook url
you see www.facebook.com/[ProfileName]
how facebook make this?
I mean ProfileName is a dynamic name
How can I create it in ASP.NEt(C#)?
Is it a subdomain or a folder? if they are how can I create without subdomain or folder?
Thanks a lot

推荐答案

它从来不是子域.子域名来自左侧,上级域名位于右侧,但在"/"之前.例如,"facebook.com"可能具有子域"software"和"resources",完整域名会以"software.facebook.com"和"resources.facebook.com"的URL出现(不,此类子域不存在)以及默认的"www.facebook.com".

实际上,域名右侧的URL的每个部分(可选:: port)仅由HTTP服务器解释,而不必与服务器主机上的目录结构相关.有多种方法可以提供所需的动态URL效果.使用ASP.NET,可以使用 URL重写技术来完成.

您可以从本文中学习它们:
http://msdn.microsoft.com/en-us/library/ms972974.aspx [ ^ ].



另一种方法是ASP.NET 路由.请参阅:
http://msdn.microsoft.com/en-us/library/cc668201.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/cc488545.aspx [ ^ ].

要将URL重写与路由进行比较,请参见:
http://msdn.microsoft.com/en-us/library/cc668201.aspx#aspnet_routing_versus_url_rewriting [^ ].

[END EDIT]

这是使用ASP.NET实施所需的几乎所有知识.作为记录,不同的服务器端技术提供了不同的方式来产生相似的服务器行为.

—SA
It is never a subdomain. The subdomain comes from left, and upper-level domain names stay on right, but before ''/''. For example, "facebook.com" could have subdomains "software" and "resources" the full domain names would come in URLs as "software.facebook.com" and "resources.facebook.com" (no, such subdomains do not exist), along with the default "www.facebook.com".

Actually, every part of URL that comes on right of the domain name (optionally with :port) is interpreted solely by an HTTP server and does not have to be anything related to the directory structure on the server host. There are different ways to provide the effect of dynamic URL you want. With ASP.NET, it can be done using URL rewriting techniques.

You can learn them from this article:
http://msdn.microsoft.com/en-us/library/ms972974.aspx[^].



Another approach is ASP.NET Routing. Please see:
http://msdn.microsoft.com/en-us/library/cc668201.aspx[^],
http://msdn.microsoft.com/en-us/library/cc488545.aspx[^].

To compare URL rewriting with routing, please see:
http://msdn.microsoft.com/en-us/library/cc668201.aspx#aspnet_routing_versus_url_rewriting[^].

[END EDIT]

This is pretty much all you need to know to implement it with ASP.NET. For a record, different server-side technologies offer very different means of producing the similar server behavior.

—SA


这篇关于Asp.Net中的URL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆