asp.net mvc - Need c# code to get domain name -



asp.net mvc - Need c# code to get domain name -

this question has reply here:

what's best method in asp.net obtain current domain? 9 answers

need c# code domain name illustration ("url: http://stackoverflow.com/questions/ask"). need output ("http://stackoverflow.com/")

next time please seek google question see if has been asked , answered. try

var domain = httpcontext.current.request.url.host;

per comments...

var domain = httpcontextbase.current.url.host;

this can mocked unit testing - meaning can set test code .

c# asp.net-mvc

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -