[已解决] Url.Authority的值错误 [英] [Solved] Wrong value for Url.Authority

查看:215
本文介绍了[已解决] Url.Authority的值错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

"System.Web.HttpContext.Current.Request.Url.Authority"给我类似"0.0.0.0:4551"的"http://localhost:4551/WebApplication"

为什么我得到0.0.0.0而不是localhost的任何指针??

最好的问候,
Zain ul Abideen

更新:
OP能够自己解决问题.

Hi All

"System.Web.HttpContext.Current.Request.Url.Authority" is giving me something like "0.0.0.0:4551" for "http://localhost:4551/WebApplication"

any pointers why i am getting 0.0.0.0 and not localhost ??

Best Regards,
Zain ul Abideen

UPDATE:
OP was able to resolve the issue himself. Posted as an answer.

推荐答案

不要使用授权,而要使用主机

Request.Url.Host

权限在dns上搜索回来,主机从URL获得站点.
当您搜索dns时,会得到与该名称相关联的IP地址的名字,而不是所有名称.
Do not use the Authority, but use the Host

Request.Url.Host

The authority search back on dns, the host get the site from the url.
When you search the dns you get the first name of your ip address that you have connected with that name and not all names.


找不到罪魁祸首,而是重新启动VS(所有实例)并更改Web开发服务器的端口可能会有所帮助

问候,
Zain ul Abideen
Couldn''t find the main culprit, but restarting VS (all its instances) and changing the port of the web development server may help

Regards,
Zain ul Abideen


这篇关于[已解决] Url.Authority的值错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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