레이블이 Url인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Url인 게시물을 표시합니다. 모든 게시물 표시

2024년 1월 3일 수요일

javascript - getUrlParams (object params)

 

    function getUrlParams() {
        var params = {};
        window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str, key, value) { params[key] = value; });
        return params;
    }


        try {
            var oParams = getUrlParams();
            if (oParams.Gubun) {
                //changeViewGubun('C');
            }
            if (oParams.Name) {
                //$("#txtName").val(decodeURI(oParams.Name));
            }
        }
        catch (e) {
        }


2021년 6월 22일 화요일

C# - Request.ServerVariables (URL, IP주소 등등)


Request Object인 ServerVariables Collection의 전체 값을 확인해보자


ServerVariables의 함수를 사용하여 IP주소, 도메인 주소 등 많은 요소들의 정보를 알아낼 수 있다.


// 클라이언트(사용자) IP 주소 (xxx.xxx.xxx.xxx)

Request.ServerVariables["REMOTE_HOST"];

// 서버 IP 주소 (xxx.xxx.xxx.xxx)

Request.ServerVariables("LOCAL_ADDR");

// 도메인 주소 (ggmouse.tistory.com)

Request.ServerVariables["HTTP_HOST"];

// 현재 경로 (/Test/ikTest.aspx)

Request.ServerVariables["PATH_INFO"];



이외에 전체 요소를 한번에 확인해보자


int loop1, loop2;

System.Collections.Specialized.NameValueCollection coll;

coll = Request.ServerVariables;

String[] arr1 = coll.AllKeys;

for (loop1 = 0; loop1 < arr1.Length; loop1++)

{

    Response.Write("<pre> " + arr1[loop1] + "</pre>");

    String[] arr2 = coll.GetValues(arr1[loop1]);

    for (loop2 = 0; loop2 < arr2.Length; loop2++)

    {

        Response.Write("<pre>" + Server.HtmlEncode(arr2[loop2]) + "</pre>");

    }

    Response.Write("<br>");

}



2019년 4월 2일 화요일

C# - Url



[Controller 에서 사용하실때]

Request.Url.Host : 도메인명

Request.Url.Authority : 도메인명 + 포트번호

Request.Url.Port : 포트번호

Request.Url.AbsolutePath : 도메인명과 포트 그리고 쿼리스트링값이 제외된 전체 주소

Request.ApplicationPath : 현재 응용 프로그램의 가상 경로 값

Request.Url.AbsoluteUri : 도메인명과 포트 그리고 쿼리스트링값이 포함된 전체 주소

Request.Url.PathAndQuery : 도메인명과 포트번호가 제외되고 쿼리스트링이 포함된 주소





[View 에서 사용하실때]

HttpContext.Current.Request.Url.Host : 도메인명

HttpContext.Current.Request.Url.Authority : 도메인명 + 포트번호

HttpContext.Current.Request.Url.Port : 포트번호

HttpContext.Current.Request.Url.AbsolutePath : 도메인명과 포트 그리고 쿼리스트링값이 제외된 전체 주소

HttpContext.Current.Request.ApplicationPath : 현재 응용 프로그램의 가상 경로 값

HttpContext.Current.Request.Url.AbsoluteUri : 도메인명과 포트 그리고 쿼리스트링값이 포함된 전체 주소

HttpContext.Current.Request.Url.PathAndQuery : 도메인명과 포트번호가 제외되고 쿼리스트링이 포함된 주소



MSSQL - Cursor vs Temp Table

#테이블 변수사용의 예 use pubs go declare @tmptable table (     nid int identity(1,1) not null,     title varchar (80) not null ) -- 테이블 변수 선언 inse...