Click here to Skip to main content
15,890,438 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow can i copy html code to clipboard by using javascript? Pin
buffering833-Apr-11 20:10
buffering833-Apr-11 20:10 
AnswerRe: How can i copy html code to clipboard by using javascript? Pin
Ankur\m/3-Apr-11 21:14
professionalAnkur\m/3-Apr-11 21:14 
GeneralRe: How can i copy html code to clipboard by using javascript? Pin
buffering833-Apr-11 22:37
buffering833-Apr-11 22:37 
Questionproblem with the web chat application Pin
Danda903-Apr-11 11:31
Danda903-Apr-11 11:31 
AnswerRe: problem with the web chat application Pin
Parwej Ahamad3-Apr-11 19:37
professionalParwej Ahamad3-Apr-11 19:37 
Questionautomation (like on whatismyip.com) Pin
Mark H Bishop3-Apr-11 11:24
Mark H Bishop3-Apr-11 11:24 
AnswerRe: automation (like on whatismyip.com) Pin
Not Active3-Apr-11 12:31
mentorNot Active3-Apr-11 12:31 
GeneralRe: automation (like on whatismyip.com) Pin
Mark H Bishop4-Apr-11 4:39
Mark H Bishop4-Apr-11 4:39 
OK, here's my page source:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetIP.aspx.cs" Inherits="TestResponse._GetIP" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
    <title></title><br />
</head><br />
<body><br />
    <form id="form1" runat="server"><br />
    <div> </div><br />
    </form><br />
</body><br />
</html>



And, here's my code behind:
protected void Page_Load(object sender, EventArgs e)
{
    string ipAddress = null;

    ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

        if (ipAddress == null)
        {
            ipAddress = Request.ServerVariables["REMOTE_ADDR"];
        }

    Response.Write(ipAddress);

}



Here's a function in a C# application that gets the data from a site:

protected internal static string scrapeIP(string fromUrl)
{
   string result=string.Empty;

   WebClient wc = new WebClient();

      result = wc.DownloadString(fromUrl);

   return result;
}




When fromUrl = "http://www.whatismyip.com/automation/n09230945.asp", the result is: "xxx.xxx.xxx.xxx"

When fromUrl = "http://www.mySite/GetIP.aspx", the result is:

"xxx.xxx.xxx.xxx
\r\n\r\n\r\n\r\n\r\n<title>\r\n\r\n\r\n\r\n \r\n\r\n\r\n
\r\n \r\n
\r\n \r\n\r\n\r\n"

I want my site to send just the IP address (like whatismyip.com/automation.....) That is, when I execute my C# function from a separate application, the returned result is just the client's external IP address.

Any ideas?
GeneralRe: automation (like on whatismyip.com) Pin
Not Active4-Apr-11 11:48
mentorNot Active4-Apr-11 11:48 
QuestionReportviewer shows unauthorized error. Pin
SamRST3-Apr-11 4:31
SamRST3-Apr-11 4:31 
AnswerRe: Reportviewer shows unauthorized error. Pin
thatraja3-Apr-11 7:19
professionalthatraja3-Apr-11 7:19 
GeneralRe: Reportviewer shows unauthorized error. Pin
SamRST3-Apr-11 21:23
SamRST3-Apr-11 21:23 
AnswerRe: Reportviewer shows unauthorized error. Pin
SamRST4-Apr-11 21:12
SamRST4-Apr-11 21:12 
QuestionApplication pool 'DefaultAppPool' has problem Pin
Hy Chanhan2-Apr-11 18:59
professionalHy Chanhan2-Apr-11 18:59 
AnswerRe: Application pool 'DefaultAppPool' has problem Pin
thatraja2-Apr-11 21:08
professionalthatraja2-Apr-11 21:08 
QuestionSql Membership / Login works local but not on production server Pin
De_Novice2-Apr-11 8:57
De_Novice2-Apr-11 8:57 
AnswerRe: Sql Membership / Login works local but not on production server Pin
De_Novice4-Apr-11 8:15
De_Novice4-Apr-11 8:15 
QuestionProblem with a drpdownlist in a datalist Pin
Nafiseh Salmani2-Apr-11 8:32
Nafiseh Salmani2-Apr-11 8:32 
AnswerRe: Problem with a drpdownlist in a datalist Pin
Abhijit Jana3-Apr-11 1:23
professionalAbhijit Jana3-Apr-11 1:23 
Questionproblem with drawing a polygon Pin
Nafiseh Salmani2-Apr-11 8:21
Nafiseh Salmani2-Apr-11 8:21 
AnswerRe: problem with drawing a polygon Pin
davidnz2-Apr-11 10:37
davidnz2-Apr-11 10:37 
QuestionMy website take so long time to reponse the pages (Slow) Pin
Hy Chanhan2-Apr-11 3:00
professionalHy Chanhan2-Apr-11 3:00 
AnswerRe: My website take so long time to reponse the pages (Slow) Pin
Not Active2-Apr-11 3:19
mentorNot Active2-Apr-11 3:19 
GeneralRe: My website take so long time to reponse the pages (Slow) Pin
Hy Chanhan2-Apr-11 3:25
professionalHy Chanhan2-Apr-11 3:25 
GeneralRe: My website take so long time to reponse the pages (Slow) Pin
Not Active2-Apr-11 3:42
mentorNot Active2-Apr-11 3:42 

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.