What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 44812 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > i got error in login ...
Reddysankark@Yahoo.Com

i got error in login

Replies: 1 | Posted by: Reddysankark@Yahoo.Com on 10/17/2012 | Category: ASP.NET Forums | Views: 197 | Status: [Member] | Points: 10  


hi
i got error like this
Input string was not in a correct format.
my coding

login.aspx.cs

protected void Button1_Click(object sender, EventArgs e)
{
string username = TextBox1.Text;
string password = TextBox2.Text;
int status = FileUpload.AuthenticateUser(username, password);
if (status >= 1)
{
Response.Redirect("~/FileUpload/Home.aspx");
}
else
{
Response.Redirect("<alert>invalid user</alert>");
}
}
fileupload.cs

public static int AuthenticateUser(string username, string password)
{

SqlParameter[] p = new SqlParameter[] { new SqlParameter("@UName", username), new SqlParameter("@Password", password) };
return int.Parse(SqlHelper.ExecuteScalar(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spAuthenticateUser", p).ToString());
}

stored procedure
ALTER procedure [dbo].[spAuthenticateUser]
(
@UName varchar(50),
@Password varchar(50)
)
AS
if exists(select Username from Image1 where Username=@UName)
begin
Select Username,Password from Image1 where [UserName]=@UName And [Password]=@Password
select 1
end
else
begin
select 0
end


my table
CREATE TABLE [dbo].[Image1](
[Id] [tinyint] IDENTITY(1,1) NOT NULL,
[ImageName] [varchar](50) NULL,
[ImageSize] [bigint] NULL,
[ImagePath] [varchar](50) NULL,
[Username] [varchar](50) NULL,
[Password] [varchar](50) NULL
)

sankarreddy


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Ranjeet_8
Ranjeet_8  
Posted on: 10/18/2012 12:38:54 AM
Level: Gold | Status: [Member] | Points: 25

Write this code instead of Response.Redirect("<alert>invalid user</alert>");

Response.Write("<script>alert('invalid user')</script>");

Reddysankark@Yahoo.Com, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 8:46:34 AM