Jump to content

Cookie Setting Problem in Mozilla


pr.nimbalkar

Recommended Posts

Dear Friends, I write this code to set cookie. it works fine in IE , but not works in Mozilla. May u help me?This is my code.Imports System.DataImports System.Security.CryptographyImports System.Web.SecurityImports System.Data.SqlClientImports System.Web.SessionStatePartial Class _Default Inherits System.Web.UI.Page Dim myCookie As New HttpCookie("TestCookie") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Request.Cookies("TestCookie") Is Nothing Then txtLogin.Text = Request.Cookies("TestCookie")("LoginName") End If End Sub Private Function Encrypt(ByVal val) Return FormsAuthentication.HashPasswordForStoringInConfigFile(val, "MD5") End Function Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click If Me.checkLogin(txtLogin.Text, Encrypt(txtPass.Text)) > 0 Then Response.Cookies.Clear() myCookie.Values.Add("LoginName", txtLogin.Text) myCookie.Expires = Now.Date.AddDays(1) Response.Cookies.Add(myCookie) End If End Sub Private Function checkLogin(ByVal login, ByVal password) As Integer Dim sqlParam As New SqlParameter Dim count As Integer With sqlParam .DbType = Data.DbType.Int32 .Direction = Data.ParameterDirection.Output .ParameterName = "@Count" End With SqlHelper.ExecuteScalar(Tools.GetConnectString, CommandType.StoredProcedure, "up_CheckLogin", New SqlParameter("@Login", login), New SqlParameter("@Pass", password), sqlParam) count = Convert.ToInt32(sqlParam.Value) Return count End FunctionEnd Class

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...