Hello there,

My page is working perfect in localhost but when I publish my site online
I get the following error:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

why? what should I do to fix this?

Any suggestions?

Need to see some code. :)

the error happens when I type admin admin to login...
MasterAdminUsers.aspx form has a grid view with no code

the other pages works fine...

If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
Label2.Visible = False
Response.Redirect("MasterAdminUsers.aspx")
Else
Label2.Visible = True 
End If

Based on the limited amount of code provided I'm speculating it could be one of two things here:

  1. The code in MasterAdminUsers.aspx is calling a resource it doesn't have permission to call (is the gridview unbound? bound? is there any code associated at all with the MasterAdminUsers.aspx page that invokes any sort of action on the part of the webserver or towards a DB server?)
  2. The settings in your webserver prohibit the use of Response.Redirect()

I can't see anything else here that would be causing those issues as you've described them so far.

Hope this helps in some way :) Mark as solved if this resolves your issue.

P.s.: As a side note I really hope that is not your 'end result' for security in logging into an admin portion of your site. It's just my personal way of doing things but even if I only have one login account for something I always mask my login variables by either storing them on a SQL server table or by having them in a separate (and less directly accessible) class definition. However, I'm assuming here that you've just done the provided code for testing reasons :)

I think I have found the solution.

I was using RadGrid to to display the data. I changed it to Grid View and everything it's working fine... the interesting thing is that i am using RadGrid in other pages and I have no problems :-O

Thanks for trying to help ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.