TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sunita Salunkhe
NA
30
16.6k
how to insert data in database by using web services
Jul 15 2014 8:11 AM
Hi
I am new in web services.
I want to run my login.aspx, i have write web service but actully i got connection error with database so where should i made connection in my project
follwing is my login button code
protected void ButtonLogin_Click(object sender, EventArgs e)
{
FlexiQService serviceClient = new FlexiQService();
try
{
if (Page.IsValid)
{
if (TextBoxUserId.Text.Trim() != string.Empty & TextBoxPassword.Text != string.Empty)
{
object[] obj = serviceClient.AuthenticateWebUser(TextBoxUserId.Text.Trim(), Encrypt.EncryptPassword(TextBoxPassword.Text.Trim()));
if (obj.Length > 0) //Authenticate
{
string[] parseArray = Parse.ParseObjectArrayToStringArray(obj);
Session["User"] = parseArray;
if ((((string[])Session["User"])[3]).ToLower() == "device")
{
LabelError.Text = ErrorMessage.loginError;
}
else
{
//Redirect to create survey page.
Response.Redirect("~/Web/Home.aspx", false);
}
}
else //Not authenticate
{
LabelError.Text = ErrorMessage.loginError;
}
}
else //If UserId or Password is empty.
{
LabelError.Text = ErrorMessage.loginError1;
}
}
}
catch (WebException)
{
LabelError.Text = ErrorMessage.connectionError;
}
catch (TimeoutException)
{
LabelError.Text = ErrorMessage.connectionError;
}
catch (SqlException)
{
LabelError.Text = ErrorMessage.connectionError;
}
catch (Exception)
{
LabelError.Text = ErrorMessage.connectionError;
}
finally
{
serviceClient.Dispose();
}
}
and this is my web service
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AuthenticateWebUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public object[] AuthenticateWebUser(string loginId, string password) {
object[] results = this.Invoke("AuthenticateWebUser", new object[] {
loginId,
password});
return ((object[])(results[0]));
}
And this is error i got:Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
can you please suggest any solution
Reply
Answers (
5
)
How to use gogle Integration in .Net?
Looking for website live chat support software ?