Session displayed in a aspx page

In ASP.net 4.0 I have a webpage say page1.aspx.

In this page I want to add a Session(“sessionval”) to an

<a href="http://www.mysite.com/page2.aspx&gt;&lt;???Session(“sessionval”)???></a>

so that the value of Session(“sessionval”) will show and be underlined an when clicked go to the link.

Is this possible?

Yes, that is possible, but would probably be better to do it from code behind. You can do something like this:
<a href=“http://www.mysite.com/page2.aspx” id=“hrefSession” runat=“server”></a>

Then from code behind:
hrefSession.InnerHTML = Session[“sessionval”].ToString();

or you can use .InnerText if it is only text. It is better to do it from code behind as you can easily wrap it in an if to check if session is not null before setting it and hiding it if it is.

But if you really want to do it from the page and not code behind, you can do this:
<a href="http://www.mysite.com/page2.aspx&gt;&lt;%=Session(“sessionval”).ToString()%&gt;&lt;/a&gt;

I hope this helps