Click here to Skip to main content
11,927,378 members (45,310 online)


GeneralRe: Unit Conversion Application - C#, IIS, ASP.NET 4.0, WCF, Windows form app Pin
MacRuturaj30-Jan-13 8:49
memberMacRuturaj30-Jan-13 8:49 
QuestionNLog question Pin
vanikanc30-Jan-13 6:46
membervanikanc30-Jan-13 6:46 
AnswerRe: NLog question Pin
Abhinav S30-Jan-13 7:09
mvpAbhinav S30-Jan-13 7:09 
QuestionHttpWebRequest Resolving to the wrong IP Address Pin
Ennis Ray Lynch, Jr.30-Jan-13 5:08
memberEnnis Ray Lynch, Jr.30-Jan-13 5:08 
File this under, it worked fine yesterday.

Uri uri = new Uri("");
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Timeout = 1;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Yesterday, this code works fine. Today it doesn't. From what I can tell I think the IP address on the server has changed. When I remove the timout and wait, I can see that an incorrect IP address is being used. However, I can browse to the URL so the DNS is correct on my system (even command line tools resolve to the correct IP) I have tried flush DNS although, to be honest, there is no reason that should work, and it didn't resolve the issue.

So, I am left assuming that somehow, the .NET framework is caching an IP address somewhere. Now, I could reset the machine or clear all of the .NET temporary files but that would leave me with a temporary solution. What I need/want is someway to force .NET, via code, to always resolve the DNS and to not use any cached DNS (Assuming this is the error)

Also, if you have any troubleshooting suggesting that are "in-code" let me know. Rebooting, etc, is not an option because this will eventually be production code so it needs to be robust, I can't hold the hands of the application.
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting.

"And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

"All users always want Excel" --Ennis Lynch

AnswerSolved my own problem Pin
Ennis Ray Lynch, Jr.30-Jan-13 6:49
memberEnnis Ray Lynch, Jr.30-Jan-13 6:49 
QuestionC# app.config permission Pin
classy_dog29-Jan-13 20:11
memberclassy_dog29-Jan-13 20:11 
AnswerRe: C# app.config permission Pin
Richard MacCutchan29-Jan-13 22:15
mvpRichard MacCutchan29-Jan-13 22:15 
AnswerRe: C# app.config permission Pin
LokoLuke30-Jan-13 1:35
memberLokoLuke30-Jan-13 1:35 
AnswerRe: C# app.config permission Pin
Shameel30-Jan-13 4:22
memberShameel30-Jan-13 4:22 
GeneralRe: C# app.config permission Pin
jschell30-Jan-13 9:07
memberjschell30-Jan-13 9:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 27 Nov 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid