I created a new db in host SQL server and Attached my existing ASPNETDB.MDF from App_Data to the new SQL db. It gave me a new connetion string and i modified in my web.config with new connection string. Thats why I can login and can retrieve information
from db. It means SQL is running. I remove role access from my Admin folder and able to access the pages in this folder. May be my loging in not geting role information from db. All these happaning in web server but running nice in my localserver. What about
the machine.config that running in my localserver but not in host , i am not sure. what to do.
Check to see if/which roles are asigned to your account.
You can see what roles your account has assigned to it by using the following code:
C#
foreach(string role in Roles.GetRolesForUser(userId)) {
response.write(role);
}
VB.NET
For Each role As String In Roles.GetRolesForUser(userId)
response.write(role)
Next
If the role in question has been assigned to your account add a Web.config file to you admin folder containing the following: (change "admin" to the name of the role allowed access)
Place your account in that role and see if you can access it which you should be able to.
Then remove your account from that role and try to access it and you should be blocked.
suman1282
Member
30 Points
28 Posts
Re: Website working in localhost using VS 2008 but problem publish in webserver
Aug 01, 2012 09:37 AM|LINK
Hi, Thanks for reply.
I created a new db in host SQL server and Attached my existing ASPNETDB.MDF from App_Data to the new SQL db. It gave me a new connetion string and i modified in my web.config with new connection string. Thats why I can login and can retrieve information from db. It means SQL is running. I remove role access from my Admin folder and able to access the pages in this folder. May be my loging in not geting role information from db. All these happaning in web server but running nice in my localserver. What about the machine.config that running in my localserver but not in host , i am not sure. what to do.
pls help.
jprochazka
Contributor
4992 Points
748 Posts
Re: Website working in localhost using VS 2008 but problem publish in webserver
Aug 01, 2012 06:11 PM|LINK
Check to see if/which roles are asigned to your account.
You can see what roles your account has assigned to it by using the following code:
C#
foreach(string role in Roles.GetRolesForUser(userId)) { response.write(role); }VB.NET
If the role in question has been assigned to your account add a Web.config file to you admin folder containing the following:
(change "admin" to the name of the role allowed access)
<configuration> <system.web> <authorization> <allow roles="admin" /> <deny users ="*" /> </authorization> </system.web> </configuration>Place your account in that role and see if you can access it which you should be able to.
Then remove your account from that role and try to access it and you should be blocked.
mayhutam
Member
2 Points
1 Post
Re: Website working in localhost using VS 2008 but problem publish in webserver
Aug 30, 2012 04:13 AM|LINK
Nice answer!