Read IP address from Cookie

  • Thread starter Thread starter Øyvind Isaksen
  • Start date Start date
Ø

Øyvind Isaksen

Hello!

Have a site that contains both ASP (3.0) and ASP.NET files.
When I log inn, my login.asp write info to a cookie to use for
authentication in my asp.net files. One of the things I write to the cookie
is the users local IP address. My problem comes when I try to "use" this IP
address in my asp.net files. When I print out the IP adress from the cookie,
it looks like theis:

127%2E0%2E0%2E1

It has to be in a format like this: 127.0.0.1

How can this be done correct??


---------------------------------------------------------------
This is how I read from the cookie in my asp.net file:

Dim ip As String = Request.Cookies("login")("ip")
Response.Write(ip & "<br>")

OUTPUT: 127%2E0%2E0%2E1
 
Oyvind,

You'll want to utilize:

Server.HtmlEncrypt

and

Server.HtmlDecrypt

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
It's URLEncoded (or is that HTMLEncoded?)
Look for the corresponding Decode method, or just do a .Replace()
 
That should be :

Server.URLEncode
and
Server.URLDecode

See the sample at : http://asp.net.do/test/URLDecode.aspx




Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
S. Justin Gengo said:
Oyvind,

You'll want to utilize:

Server.HtmlEncrypt

and

Server.HtmlDecrypt

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Oops,

Thanks for the correction Juan. I've pulled that out of memory, knew it was
one of the two, and remembered it wrong...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
Juan T. Llibre said:
That should be :

Server.URLEncode
and
Server.URLDecode

See the sample at : http://asp.net.do/test/URLDecode.aspx




Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
 
Back
Top