How to put both chapter and section name in the header of the page?

A possible solution is to use the scrreprt class option twoside=semi (with margins like oneside, but different \leftmark and \rightmark).

\documentclass[twoside=semi]{scrreprt}

\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\lehead{\leftmark}
\rehead{\rightmark}
\lohead{\leftmark}
\rohead{\rightmark}

\usepackage{lipsum}

\begin{document}

\chapter{foo}

\section{foobar}

\lipsum[1-12]

\chapter{bla}

\end{document}

This does exactly what you need. The only necessary thing was a proper definition of \sectionmark:

\documentclass{scrreprt}

\usepackage[autooneside]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark{chapter}
\renewcommand\sectionmark[1]{\markright{\MakeMarkcase {\thesection\hskip .5em\relax#1}}}
\rohead{\ifnum\expandafter\pdfstrcmp\botmark=0 \rightmark\else\leftmark{} --- \rightmark\fi}

\usepackage{lipsum}

\begin{document}

\chapter{Cht}
\section{Sct}
\lipsum
\section{SScctt}
\lipsum

\end{document}

This actually shows Section -- Chapter, to show them the other way around, change \leftmark{} --- \rightmark to \rightmark{} --- \leftmark.


Note, that scrpage2 is depreciated. So here is a suggestion using scrlayer-scrpage.

\documentclass{scrreprt}

\usepackage[automark,autooneside=false]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\leftmark\ifstr{\rightmark}{\leftmark}{}{ -- \rightmark}}

\usepackage{lipsum}
\begin{document}
\chapter{Cht}
\section{Sct}
\lipsum
\section{SScctt}
\lipsum
\chapter{Next}
\lipsum
\end{document}

If you want to use the outdated package scrpage2 remove option autooneside and use \automark[section]{chapter}.

\documentclass{scrreprt}

\usepackage{scrpage2}
\automark[section]{chapter}
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead{\leftmark\ifstr{\rightmark}{\leftmark}{}{ -- \rightmark}}

\usepackage{lipsum}
\begin{document}
\chapter{Cht}
\section{Sct}
\lipsum
\section{SScctt}
\lipsum
\chapter{Next}
\lipsum
\end{document}