pr.nimbalkar Posted March 21, 2007 Share Posted March 21, 2007 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 More sharing options...
pulpfiction Posted March 23, 2007 Share Posted March 23, 2007 Possible that should be a browser setting issue. check the option to enable/disable cookies.http://www.google.com/cookies.html OR http://www.timeanddate.com/custom/cookiesmozilla.html Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now