Link to home
Start Free TrialLog in
Avatar of mikha
mikhaFlag for United States of America

asked on

asp.net web site project

I have a simple asp.net website, with a default page and on page_load function , I check some basic user information by calling a web service, getting a response and checking whether or not a certain value exists in the response for every user. I don't fully understand page cycle and post back in asp.net website.
My current code looks like following sample.

I am not sure , when this IsPostback returns true or false. My assumption is that my code to call the web service only fires when the page loads , after that i don't have to call it again for the same user. does the following code construct accomplishes that . if not what can i do to achieve that.

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {        
               if (! IsPostback )  {
                   
                   //call web service 
                    if ( response != null && hasSomeValue) {
                    
                        //user is authenticated and has full access to the site 

                    }
              }
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mikha

ASKER

@chinmay - thanks. yes this is an existing asp.net web forms website, I have to change.

the authentication is done, on a different web application. which does the authentication and sets some cookies for the user.
In my site, i check those cookies and also make a call to another website, to get users access level and such.

like you said, I can set some value in the session and check it, so that i don't have to call the web service in other pages as well.
Hi Mikha,

Just checking in, do you need further help with this question? if not, please close it.

Regards,
Chinmay.
Avatar of mikha

ASKER

@chimmay - thanks for the follow up. no more questions on this one. I will close this ticket.