Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6886819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:48:26+00:00 2026-05-27T05:48:26+00:00

Am new to Asp.Net Programming, Have just started a web project. Am calling a

  • 0

Am new to Asp.Net Programming, Have just started a web project.
Am calling a WebMethod from Aspx page using JSON like below:

 <script type="text/javascript">

    function getLogin() {
        var userName = document.getElementById('TextBox1').value;
        $.ajax({
            type: "POST",
            url: "Services/LogService.asmx/authenticateLogin",
            data: "{'userName':'" +userName.toString()+ "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
            alert(response.d)
            },
            error: function (xhr, status, error) {
                // alert(textStatus);
                DisplayError(xhr);
            }

        });
    }


function DisplayError(xhr) {
 var msg = JSON.parse(xhr.responseText);
 alert(msg.Message);  }
</script>

And WebMethod :

[WebMethod]
    public string authenticateLogin(string userName)
    {
        LoginBO loginBO = new LoginBO();
        loginBO.userName = userName.ToString().Trim();
        string result = "";
        try
        {
            LoginDao loginDao = DAOFactory.GetDaoFactory().getLoginDao();
            result = loginDao.selectUser(loginBO);
        }
        catch (DBConnectionException)
        {
            //result = "DB Conenction";
            throw new Exception("DB Connection is Down");
        }

        catch (InvalidLoginException)
        {
            //HttpResponse res = new HttpResponse();
            //HttpResponse.ReferenceEquals.Redirect("~/Login.aspx");
            throw new InvalidLoginException("Login Is Invalid");
        }
        catch (Exception)
        {
            throw new Exception("Uanble to Fetch ");
        }
        int ctx = Context.Response.StatusCode;
        return result;
    }

After Successful Authentication, I want to redirect user to another aspx page.

What is the best practice to do ?

Thanks
Samuel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:48:27+00:00Added an answer on May 27, 2026 at 5:48 am

    Add a redirect to the success section of your getLogin() function:

    success: 
      function (response) {
        alert(response.d);
        windows.location.href = "http://url.for.redirect";
      }
    

    (Or use some other method for redirecting within jQuery/Javascript).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to ASP.NET programming, and web programming in general. We have
I have a web site built using asp.net with ugly URLs like /DisplayContent.aspx?id=789564 .
I'll admit, I am pretty new with ASP .NET programming and I have been
hello I'm new to PHP programming and I migrated from ASP .net to PHP..
I am new to programming. Using C# & ASP.Net, how would I differentiate between
I'm pretty new to web programming, reading a book on ASP.NET, and I notice
I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
From the developer preview What’s New for ASP.NET 4.5 and Web Development it seems
Probably its my first question in ASP.Net. I am new to Web-Programming and trying
I have a brand new asp.net mvc 3 project. I did not modify the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.