Notice
Recent Posts
Recent Comments
Tags
- jquery 바코드생성
- django 엑셀불러오기
- javascript 바코드 생성
- 하드 윈도우 복사
- 맥 오라클설치
- ViewBag
- SSD 복사
- asp.net dropdownlist
- XSS방어
- 바코드 스캔하기
- Mac Oracle
- javascript redirection
- TempData
- 파일업로드 체크
- php 캐쉬제거
- ViewData
- 강제이동
- ASP.Net Core 404
- asp.net Select
- 바코드 생성하기
- asp.net core Select
- javascript 바코드스캔
- XSS PHP
- jquery 바코드
- 404에러페이지
- 하드 마이그레이션
- 타임피커
- 말줄임표시
- 파일업로드 유효성체크
- javascript 유효성체크
웹개발자의 기지개
[ASP.Net Core] 현재페이지 경로 정보 얻기 본문
Razor View 페이지 상에서
Context.Request.GetDisplayUrl()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
@using Microsoft.AspNetCore.Http.Extensions
@{
//http://naver.com/Sports/Detail/33/1?Page=1&code=test
//string url = Context.Request.GetDisplayUrl();
string url = Context.Request.GetDisplayUrl();
//naver.com
string url2 = Context.Request.Host.ToString();
}
@Html.Raw(url)
<br />
@Html.Raw(url2)
|
cs |
ASP.Net 과 ASP.Net Core 의 관련 소스가 틀리다.
ASP.Net 의 현재 경로는 아래의 포스팅글을 참고하면 좋을것 같다.
HttpContext.Current.Request.Url.AbsolutePath
asp.net(c#)에서 현재 페이지의 url을 가져 오는 방법
Request.Url 을 이용하시면 url 정보를 가져올수 있습니다. 사용 방법에 따라서 가져오는 데이터가 조금 다릅니다. 우선 사용방법입니다. Controller 에서 사용하실때 Request.Url.Host : 도메인명 Request.Url.A
xctt.tistory.com
참고 : https://stackoverflow.com/questions/70485236/how-to-get-full-url-in-asp-net-core-razor-pages
참고 : https://xctt.tistory.com/25
'ASP.NET > ASP.NET Core' 카테고리의 다른 글
[ASP.Net Core] 로그인한 다음 이전페이지로 자동 이동 ReturnUrl 기능구현하기 (0) | 2023.05.13 |
---|---|
[ASP.Net Core] ViewBag, ViewData, TempData 와 ASP.Net Web-Form 방식의 ViewState 비교하기 (0) | 2023.04.29 |
[ASP.Net Core] Radio박스에서 Checked 와 Select 박스 option Selected 처리하기 (0) | 2023.04.19 |
[ASP.Net Core] 배포시 Development Mode 에러날때 - ASPNETCORE_ENVIRONMENT (0) | 2023.04.10 |
[ASP.Net Core] PC인지 모바일인지 체크하기 (0) | 2023.03.19 |
Comments