Code not working on IIS

Last post 12-16-2006 5:51 AM by sohaiil. 4 replies.

Sort Posts:

  • Sad [:(] Code not working on IIS

    12-14-2006, 1:50 AM
    • Loading...
    • sohaiil
    • Joined on 06-23-2005, 2:00 AM
    • Posts 5

    Hi,

     i am using the following sample code to show the existing Roles, but this code works only on ASP.NET development server (http://localhost:2775/App/Default.aspx), but when i am calling this application through http://localhost/App/Default.aspx, it does'nt work.

     string[] roles = Roles.GetAllRoles();

    Response.Write("<br/> total roles are: " + roles.Length);

    for (int i = 0; i < roles.Length;i++ )

    {

    Response.Write("<br/> " + roles[i].ToString() );

    i am not sure what is the problem, i am using ASP.NET 2.0 on IIS and Visual Studio 2005.

    Thanks in advance for suggestions!

    Regards

  • Re: Code not working on IIS

    12-14-2006, 2:34 AM

    Make sure you have configured the database correctly when you are accessing the Roles in the second application!

    Are you getting any exceptions? try to debug and tell us what you get!

    Regards

    Bilal Hadiar, MCP, MCTS, MCPD, MCT
    Microsoft MVP - Telerik MVP
  • Re: Code not working on IIS

    12-14-2006, 5:29 PM
    • Loading...
    • sohaiil
    • Joined on 06-23-2005, 2:00 AM
    • Posts 5

    Thanks for your reply!

     Actually my login form works on both IIS, and development server, there is no exception as such,  user is logged in properly each time with the given name and password. but when i user is logged in, i am printing the username and Roles on ReturnedURL, that's where the problem is. it says no roles are there........ thanks

  • Re: Code not working on IIS

    12-15-2006, 4:34 AM
    Answer
    Make sure you've set appropriate applicationName attributes for all providers defined in web.config. You can take a look at this article:
    Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers
    Welcome to my SQL/ASPNET forum for Chinese
    http://51up.org/bbs/forumdisplay.php?fid=38
  • Re: Code not working on IIS

    12-16-2006, 5:51 AM
    • Loading...
    • sohaiil
    • Joined on 06-23-2005, 2:00 AM
    • Posts 5

    Hi Lori, thanks for your reply!

    as i was using my own Customer tables for storing passwords and usernames, but u was using asp.net role managers and membership classes to store the roles, that is why it was validating my customers but was'nt showing me the roles.

    Thanks again for such a nice reply and forum link, it really have helped me a lot! as i hav'nt got my application with me right now but i am sure never wrote the applicationName in web.config.

     I hope it will solve my problem this monday!

     cheers!!!!!!

     

Page 1 of 1 (5 items)
Microsoft Communities
Page view counter