|
Forums » .NET » ASP.NET »
Posted Date: 12 Jul 2012 Posted By:: saravanakumar Member Level: Gold Member Rank: 197 Points: 5
Responses:
5
|
hi friends, this code is placed in the web.config file.
<location path="amc.aspx" > <system.web> <authorization> <allow users="saravana" /> <deny users ="*"/> </authorization> </system.web> </location>
the code describes saravana user only access the amc.aspx page others are not accessed. the sarava user enter the amc.aspx means the corresponding page displayed. others means no other pages displayed.
i need to display the permission denied message in messagebox or other page. if it is possible means give the solutions.
|
Responses
|
#680028 Author: Ajatshatru Upadhyay Member Level: Gold Member Rank: 19 Date: 12/Jul/2012 Rating:  Points: 3 | Hi,
If you want to have a single error page for your entire application, which displays some custom error message, then create an error page, and add it to your web.config file as
<system.web> <customErrors mode="On" defaultRedirect="Error.aspx"></customErrors> </system.web>
Hope it'll help you. Regards Ajatshatru
| #680031 Author: Anil Kumar Pandey Member Level: Platinum Member Rank: 1 Date: 12/Jul/2012 Rating:  Points: 2 | You can set this in web config it self by setting the page for redirection if error.
<configuration> <system.web> <customErrors defaultRedirect="error.htm" mode="On" /> </system.web> </configuration>
Thanks & Regards Anil Kumar Pandey Microsoft MVP, DNS MVM
| #680034 Author: saravanakumar Member Level: Gold Member Rank: 197 Date: 12/Jul/2012 Rating:  Points: 1 | than k u Ajatshatru Upadhyay it is working fine. then i need another help. in my project i am using form based authentocation.
in my database the login table have userid,password,status. the status is login /logout.
when the login give the username and password in login page the webpages will opened and they do anything.
and the user when press the logout the login table status field is updated with the logout.
the problem is, user logged in successfully and they do something and not press logout and not doing anything more than 20 to 30 minutes means the page will be redirect into login web page.
i am not using session timeout and am also write the logout code in application end and session end in global.asax but not solve this problem.
| #680043 Author: Ajatshatru Upadhyay Member Level: Gold Member Rank: 19 Date: 12/Jul/2012 Rating:  Points: 2 | Hi,
Why are you not using Session timeout? Use Session timeout and in web.congig, do below:
<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication>
Hope it'll help you. Regards Ajatshatru
| #680128 Author: saravanakumar Member Level: Gold Member Rank: 197 Date: 12/Jul/2012 Rating:  Points: 1 | i need how to run that blow code when the session expries
SqlConnection con = new SqlConnection(constr); con.Open(); SqlDataAdapter dAdapter = new SqlDataAdapter("update login set status='Logout',logouttime='" + DateTime.Now.ToString() + "' where uid='" + HttpContext.Current.User.Identity.Name + "'", con); DataSet ds = new DataSet(); dAdapter.Fill(ds, "table"); con.Close();
|
|
| Post Reply |
|
|
|
 | | This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post. |
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|