Answered
Adobe Tutorial Help please?
Hi,
Trying to do the tutorial but have no idea of C#. I have tried running the code through a convertor but keep getting errors. Can anyone convert this from C# to VB
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
// Don't cache this page.
Response.Expires = -1;
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("cache-control", "no-store");
if (IsPostBack)
{
// Check user credentials entered on the page
if ((emailaddr.Value == DS_uidAndPwd.FieldValue("emailaddr",null)) && (password.Value == DS_uidAndPwd.FieldValue("password",null)))
{
// The user has been authenticated.
// 1. Create the authentication ticket.
// 2. Redirect to the appropriate page.
// 1. Create the authentication ticket.
// Create and use the forms authentication ticket.
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
Request.Form["emailaddr"],
DateTime.Now, // issue time
DateTime.Now.AddMinutes(30), // expires in 30 minutes
false, // not persistent
"member"); // role assignment gets stored in the UserData
// Create a new (encrypted) HttpCookie using the ticket just created
// and name it accordingly to the value specified in the <forms> element
// in the web.config file.
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
// Add the cookie to the outbound response.
Response.Cookies.Add(cookie);
// Redirect as appropriate.
String returnUrl;
if (Request.QueryString["ReturnURL"] == null)
{
returnUrl = "/members/index.aspx";
}
else
{
returnUrl = Request.QueryString["ReturnURL"];
}
Response.Redirect(returnUrl);
}
else
{
Msg.Text = "Invalid Credentials: Please try again";
}
}
}
</script>
Many Thanks
Trying to do the tutorial but have no idea of C#. I have tried running the code through a convertor but keep getting errors. Can anyone convert this from C# to VB
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
// Don't cache this page.
Response.Expires = -1;
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("cache-control", "no-store");
if (IsPostBack)
{
// Check user credentials entered on the page
if ((emailaddr.Value == DS_uidAndPwd.FieldValue("emailaddr",null)) && (password.Value == DS_uidAndPwd.FieldValue("password",null)))
{
// The user has been authenticated.
// 1. Create the authentication ticket.
// 2. Redirect to the appropriate page.
// 1. Create the authentication ticket.
// Create and use the forms authentication ticket.
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
Request.Form["emailaddr"],
DateTime.Now, // issue time
DateTime.Now.AddMinutes(30), // expires in 30 minutes
false, // not persistent
"member"); // role assignment gets stored in the UserData
// Create a new (encrypted) HttpCookie using the ticket just created
// and name it accordingly to the value specified in the <forms> element
// in the web.config file.
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
// Add the cookie to the outbound response.
Response.Cookies.Add(cookie);
// Redirect as appropriate.
String returnUrl;
if (Request.QueryString["ReturnURL"] == null)
{
returnUrl = "/members/index.aspx";
}
else
{
returnUrl = Request.QueryString["ReturnURL"];
}
Response.Redirect(returnUrl);
}
else
{
Msg.Text = "Invalid Credentials: Please try again";
}
}
}
</script>
Many Thanks
