Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to make code run differently depending on the platform it is running on?

localhost c# asp.net

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 xarzu

xarzu

    CC Newcomer

  • Member
  • PipPip
  • 20 posts

Posted 05 April 2019 - 09:17 AM

How to make code run differently depending on the platform it is running on?

I have a challenge for you.

I have an ASP.NET Web Application built in C# with Microsoft Visual Studio 2017.  There is a line of code that we have had to include in order for it to run on a localhost when debugging by attaching it to a running process in a web browser.

Here is the issue.  That line of code is not necessary when the process is running on the server.

I can remove that line when I submit the code in TFS.  But it would be great if we could make the code somehow ignore that line depending on what platform it is running on.

How can you think this could be done?






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download