How get root url path

17,625

Solution 1

ASPX: Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath

Implemented with Javascript:

<script type="text/javascript">
    var rootUrl = '<% =(Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath) %>';
</script>

Solution 2

in javascript you can get url information from the location object.

var href = location.href; //returns the entire url
var host = location.hostname; //returns just the hostname of the url.
Share:
17,625
MiBol
Author by

MiBol

An ambitious developer with a strong technical background and expertise in multiples languages like C#, VB.Net, JavaScript, Transact-SQL, among others; who possesses self-discipline and the ability to work with the minimum of supervision. Able to play a key role throughout the software development/support life cycle of a project to ensure that quality solutions meet business objectives. Possessing a good team spirit, deadline orientated and having the ability to organize and present complex solutions clearly and accurately. I possess more than 12 years of experience leading end-to-end development since understand the specific need of the business, document, present a plan with the expectations of the new system, a development the system, perform testing phases, put the tool on production and working in the maintenance and continual improvement. I have the experience to work in tandem with the final users, to understand their work and bring a quality, simple and fast systems that meet their needs and accomplish the business expectations. Along my career, I've been developing more than 150 solutions and systems (most of them worked without a technical partner). I’m working on implementation projects among Accounts Payable and Receivable, Treasury, Purchasing, Affiliates, Taxes, HR, etc. In my latest years, I’m been working as coordinator of tech team (11 members) providing technical consulting, trainer of new topics and technologies, sharing experiences, and advice about the best way to develop a system based on a specific need. I steward other technologies as BluePrism/RPA/Robotics, Microsoft Azure, Knime, SAP Lumira and others

Updated on July 09, 2022

Comments