Solved

Detect if Visual Studio 2012  app is running from localhost

Posted on 2014-11-02
6
193 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
  • 3
  • 3
6 Comments
 
LVL 32

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 32

Expert Comment

by:Big Monty
ID: 40420189
blnLocal = (System.Web.HttpRequest.isLocal);
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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 32

Accepted Solution

by:
Big Monty earned 500 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 5 115
Refresh Datagridview from another form 1 28
WEB Farm 6 25
Image(2) 3 26
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now