Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpContext.Current.Request.ApplicationPath is empty on production

Tags:

c#

asp.net

On my development server HttpContext.Current.Request.ApplicationPath correctly returns the path, but on production it returns empty.

Why woudld this be?

I am using this to build URL's, and now in production a link doesn't work as it looks like:

http://section/page1.aspx

but it should be:

https://www.example.sub.com/section/page1.aspx

What could be causing this?

like image 773
loyalflow Avatar asked May 27 '26 13:05

loyalflow


1 Answers

The ApplicationPath property returns the path to the folder where the application is, and it doesn't include the domain name.

I imagine that you have put the application in a folder with the same name as the domain name in your development server. The property then returns the name of the folder, not the actual domain.

like image 186
Guffa Avatar answered May 30 '26 05:05

Guffa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!