c# - Getting URL without port when running from VS, or without application name when running in IIS -


my application's url looks when run debugger

http://localhost:52230/ 

and in iis:

http://localhost/myapp 

or, when i'm browsing pc,

http://192.168.168.11/myapp 

where myapp = application's name.

is there way, using razor syntax, http://localhost or http://192.168.168.11 only?

i tried @url.content("~/) returns me http://localhost:52230/

try

@(context.request.url.scheme + "://" + context.request.url.dnssafehost) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -