Jump to content
Marcio_123

PEGANDO URL COM get_url

Recommended Posts

Ola Galeria blz,

 

Podem me ajudar na seguinte questão, preciso pegar parte da url.

 

Ex: Tenho a url: www.site.com.br/Pagina.php

 

No meu get_url preciso pegar somente a parte  Pagina

 

Valeu galera por compartilhar o conhecimento.

abraços

Share this post


Link to post
Share on other sites

Você consegue pegar diferentes partes da URL:

 

Se fosse a URL: http://localhost:8080/mysite/page.aspx?p1=1&p2=2

 

HttpContext.Current.Request.Url.Host
localhost

HttpContext.Current.Request.Url.Authority
localhost:8080

HttpContext.Current.Request.Url.AbsolutePath
/mysite/page.aspx

HttpContext.Current.Request.ApplicationPath
/mysite

HttpContext.Current.Request.Url.AbsoluteUri
http://localhost:8080/mysite/page.aspx?p1=1&p2=2

HttpContext.Current.Request.RawUrl
/mysite/page.aspx?p1=1&p2=2

HttpContext.Current.Request.Url.PathAndQuery
/mysite/page.aspx?p1=1&p2=2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.