I can use this <%= Request.ServerVariables["SERVER_NAME"] %> to get the server name of the current page. How do I get just the last three characters? All I want is the dev or stg or org part.

Recommended Answers

All 2 Replies

If you are using Linq; ...

string strExtension = Request.ServerVariables["SERVER_NAME"].Split('.').Last();

?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.