?
Solved

Detect if Visual Studio 2012  app is running from localhost

Posted on 2014-11-02
6
Medium Priority
?
213 Views
Last Modified: 2014-11-03
I can run my app either from the localhost or from the server.

I need code to identify where the app is running from.
My test is:
if (context.Request.Url.ToString().StartsWith("http://localhost"))

This returns "".

Is there another way?

Thanks
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 40419608
0
 

Author Comment

by:Dovberman
ID: 40419974
I am using c#.

   Boolean blnLocal = true ;
     
What is the proper syntax?      
  ???          blnLocal = (System.Web.HttpRequest.

Thanks
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40420189
blnLocal = (System.Web.HttpRequest.isLocal);
0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 

Author Comment

by:Dovberman
ID: 40420202
blnLocal = (System.Web.HttpRequest.isLocal);

Error      4      'System.Web.HttpRequest' does not contain a definition for 'isLocal'      C:\Users\David\Documents\Visual Studio 2012\Projects\StockPickerMax\StockPickerMax\Admin\MaintainDataDaily.aspx.cs      369      48      StockPickerMax
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 40420311
sorry, should be

blnLocal = (Request.isLocal);

example - http://www.4guysfromrolla.com/articles/082609-1.aspx
0
 

Author Comment

by:Dovberman
ID: 40420408
Thanks
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question