I have an ASPX page which gets the visitors domain username on load. I need to then automatically transfer the visitor to another page (CSHTML) and pass their username as well.
I found a way using the ASP code below to transfer the user and the variable to the other CSHTML page. This is probably not the best way but its all I could think of (just started with ASP)
My question is, is it possible to do the same thing where the ASPX will automatically redirect to another page and pass the variable but not in the URL? I don't want to pass the username in the URL because that parameter can later be changed by anyone.
So my requirements are (1) Automatically go from the ASPX page to CSHTML page on load without having the user click on anything and (2) Pass a variable to the CSHTML page but not in the URL
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Environment" %>
<%@ Import Namespace="System.Security" %>
<%@ Import Namespace="System.Security.Principal.WindowsIdentity" %>
<script runat="server" language="VB">
'On page load
Sub Page_Load()
Response.Write("<HTML>")
Response.Write("<HEAD>")
Response.Write(String.Format("<meta http-equiv=""refresh"" content=""0; url=http://iisserver/cshtmlpages/target_page.cshtml?authuser="))
Response.Write(Context.User.Identity.Name)
Response.Write(String.Format(""" />"))
Response.Write("</HEAD>")
Response.Write("</HTML>")
End Sub
</Script>