Hello.
If my users are logged in, and try to access restricted pages I want
to direct them to a custom 403 page. If they are not logged in, I
would like to continue to direct them to the login page as is
currently happening.
Curently, they always direct to the Login page in both cases, which i
think is confusing.
I have this in the web.config of the directory and the project
webconfig:
<customErrors defaultRedirect ="~/ErrorPage.htm">
<error statusCode="403 " redirect="~/NoAccess.htm"/>
<error statusCode="404 " redirect="~/FileNotFound.ht m"/>
</customErrors>
Thanks for any help or information! 4 1917
There are a number of different ways to handle this, an easy one would be
something like so:
Page_Load ----
if(! User.IsInRole(" whateverspecial Role")
Response.Redire ct("yourcustomp age.aspx")
This assumes your <location path= element specifies role-based permissions.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"jobs" wrote:
Hello.
If my users are logged in, and try to access restricted pages I want
to direct them to a custom 403 page. If they are not logged in, I
would like to continue to direct them to the login page as is
currently happening.
Curently, they always direct to the Login page in both cases, which i
think is confusing.
I have this in the web.config of the directory and the project
webconfig:
<customErrors defaultRedirect ="~/ErrorPage.htm">
<error statusCode="403 " redirect="~/NoAccess.htm"/>
<error statusCode="404 " redirect="~/FileNotFound.ht m"/>
</customErrors>
Thanks for any help or information!
"jobs" <jo**@webdos.co mwrote in message
news:11******** **************@ c77g2000hse.goo glegroups.com.. .
Hello.
If my users are logged in, and try to access restricted pages I want
to direct them to a custom 403 page. If they are not logged in, I
would like to continue to direct them to the login page as is
currently happening.
Curently, they always direct to the Login page in both cases, which i
think is confusing.
I have this in the web.config of the directory and the project
webconfig:
<customErrors defaultRedirect ="~/ErrorPage.htm">
<error statusCode="403 " redirect="~/NoAccess.htm"/>
<error statusCode="404 " redirect="~/FileNotFound.ht m"/>
</customErrors>
Thanks for any help or information!
As Peter said, there are many ways.
In my application, I keep the username from the login-form in a session var.
Next, on any form load, I check the username for access rights. If not
granted, the user is redirected to the login form.
This gives me even more options: On some forms I can give readonly right to
certain users, while other users can update the database. In my case I have
a user login table on a SQL server with more than granted access/not granted
access; I have about 10 properties for each user so I can set a lot of
individual settings in each form. It is very flexible and very functional.
Bjorn
Thanks for responses.
regarding:
In my application, I keep the username from the login-form in a session var.
Next, on any form load, I check the username for access rights. If not
granted, the user is redirected to the login form.
I believe this is the default behavior of membership security. (that
much is working fine for me with no code)
regarding:
if(! User.IsInRole(" whateverspecial Role")
Response.Redire ct("yourcustomp age.aspx")
It think it is somewhat lacking (in .NET) that you have to code
security conditions. I have some 8 roles.
Also, I think I would to check if even a valid user to redirect to
Login Page as that condition would also be true for anonymous users.
I wonder ... what if I (somehow) test to see if already a valid user
in the Login page and redirect to NoAccess from there? and if a
user, just direct to default page. Not sure if this is possible.
You could certainly do it that way. Another way would be to override
Application_Aut henticateReques t in global.asax and put your test logic there.
Again, it all depends on the particular business logic of your app.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"jobs" wrote:
Thanks for responses.
regarding:
In my application, I keep the username from the login-form in a session var.
Next, on any form load, I check the username for access rights. If not
granted, the user is redirected to the login form.
I believe this is the default behavior of membership security. (that
much is working fine for me with no code)
regarding:
if(! User.IsInRole(" whateverspecial Role")
Response.Redire ct("yourcustomp age.aspx")
It think it is somewhat lacking (in .NET) that you have to code
security conditions. I have some 8 roles.
Also, I think I would to check if even a valid user to redirect to
Login Page as that condition would also be true for anonymous users.
I wonder ... what if I (somehow) test to see if already a valid user
in the Login page and redirect to NoAccess from there? and if a
user, just direct to default page. Not sure if this is possible. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
Hi
I was working fine with create user wizard and the default membership
provider. I have now customised the membership provider as per attached
web.config. The create user wizard picks up the custom membership provider
fine and removes the security question/answer fields as designated in the
custom provider.
The problem is that when I try to create a new user in the create user
wizard by entering the info and pressing the 'create...
|
by: ad |
last post by:
I have create a custom membership provider.
The common usage of custom membership is set it as default Membership
Provider win web.config, and use login controls with it.
How can I use custom membership provider without Login Controls?
For example, the name of my custom membership provider MyMembershipProvider.
Is the codes below right?
MyMembershipProvider myProvider=new MyMembershipProvider();
|
by: Paul Keegstra |
last post by:
Hi,
I am currently working on an asp.net 2.0 web site that is a replacement of a
classic asp web site. The current web site uses a Commerce Server 2002
database for storing user information. It does not currently use any of the
Commerce Server 2002 functionality with the exception of the user
authentication features.
I have written my replacement application to use a custom login form and
custom connection string so that I can use...
|
by: John |
last post by:
OK, I read and read again information on using the logon control, 'custom
providers' but none are really helping me out with creating a provider to
go against my database to validate the users logging into my web app. What
happens when a user logs into my site is, 8 queries are executed, 1 verfies
the user, and the others get data pertaining to that users id, so drop downs
are populated for that user, etc., So is it possible to use the...
|
by: Dabbler |
last post by:
I need to have users login using the ASP.NET sqlprovider but then would like
to direct them to a page based on some info in a separate table. Is there
code to generate the strange userid field in the membership table so I can
assign the userid to my table column and then search for my table row using
this user id?
Any other suggestions (besides writing a custom provider which I haven't the
time for) on how to achieve this linkage?
...
| |
by: jason |
last post by:
I've been playing around with new (for 2.0) membershp functionality.
I was able to build a simple login form that secures a directory on a
project I built locally on my development desktop.
However, when I attempt to follow the same steps on the remote test
server (a website I access via filesystem security accross my lan ).. I
get the following when I attempt to select the security tab from the
administer selection of the login...
|
by: =?Utf-8?B?Q2hyaXMgQ2Fw?= |
last post by:
I have been having some trouble with implementing a custom Membership
Provider. We have a custom data store and business logic that pulls user
information. I need some level of functionality above and beyond what the
prodiver currently allows. I need the ability to access a user id and the
user's permission id. With Forms authentication in 1.1, I would just create
a custom identiy and principal and store the information in the identity....
|
by: dm3281 |
last post by:
Hello --
I need to write an ASP.NET 2.0 application for our clients to use to login
and verify file transmissions. Each client will need their own logon, in
addition to a way to assign each user a unique customerid. All users
beloning to the same custeromid would see the same information on the
website.
Can I easily do this using membership services or must I use a combination
of membership services and profiles?
|
by: Jeff |
last post by:
Hey
ASP.NET 2.0
At work my boss have given me the task of developing a new website. Users
will be able to register at the website and gain exclusive access to some
information etc... Some users will have limited access to the information
and some users (Administrators) will have total access. There will be 3
levels of users: Normal User, Power User and Administrator.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |