473,752 Members | 9,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to redirect different users to different pages?

I am not sure how to google this concept.

Basically, what I wanna do is to direct different users to different
pages. I do not have a whole lot users.

For example, if user name 'tomcat' logins successfully with the correct
password, I want to direct this guy to 'tomcat_page.as px'. And if the
user name 'jerrymouse' logins successfully with the right password, I
want to direct him to 'jerrymouse_pag e.aspx'.

In other words, I want to be able to do

If (txtUsername.Te xt = "tomcat") Then
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then
Response.Redire ct("jerrymouse_ page.aspx")
End If

I think this would be a pretty easy task, but I am new to
authentication/authorization and have no clue.

Mar 7 '06 #1
9 2039
Do you mean like this ?

Response.Redire ct(txtUsername. Text + "_page.aspx ")

<an***********@ yahoo.com> wrote in message news:11******** **************@ j52g2000cwj.goo glegroups.com.. .
I am not sure how to google this concept.

Basically, what I wanna do is to direct different users to different
pages. I do not have a whole lot users.

For example, if user name 'tomcat' logins successfully with the correct
password, I want to direct this guy to 'tomcat_page.as px'. And if the
user name 'jerrymouse' logins successfully with the right password, I
want to direct him to 'jerrymouse_pag e.aspx'.

In other words, I want to be able to do

If (txtUsername.Te xt = "tomcat") Then
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then
Response.Redire ct("jerrymouse_ page.aspx")
End If

I think this would be a pretty easy task, but I am new to
authentication/authorization and have no clue.

Mar 7 '06 #2
Actually what you want to do (since the user has succesfully logged in)
is:
Response.Redire ct(User.Identit y.Name & "_page.aspx ")

You could also have a look at the RewritePath method if you want it
more fancy.

Mar 7 '06 #3
Thanks, but I am using form authentication like so:

<script runat="server">
Sub btnSubmit_Click (sender as object, e as eventargs)
If FormsAuthentica tion.Authentica te(txtUsername. text,
txtPassword.tex t) Then
FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("wheretogo.a spx")
Else
lblMsg.Text = "Invalid username or password"
End If
End Sub
</script>

In other words, the user names and passwords are all set up in
web.config. They are authenticated as a group as shown in the code
above. So I have no means in the .Net VB code to check the individual
user name and password.

Should I use windows authentication instead?

Adrian Parker wrote:
Do you mean like this ?

Response.Redire ct(txtUsername. Text + "_page.aspx ")

<an***********@ yahoo.com> wrote in message news:11******** **************@ j52g2000cwj.goo glegroups.com.. .
I am not sure how to google this concept.

Basically, what I wanna do is to direct different users to different
pages. I do not have a whole lot users.

For example, if user name 'tomcat' logins successfully with the correct
password, I want to direct this guy to 'tomcat_page.as px'. And if the
user name 'jerrymouse' logins successfully with the right password, I
want to direct him to 'jerrymouse_pag e.aspx'.

In other words, I want to be able to do

If (txtUsername.Te xt = "tomcat") Then
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then
Response.Redire ct("jerrymouse_ page.aspx")
End If

I think this would be a pretty easy task, but I am new to
authentication/authorization and have no clue.


Mar 7 '06 #4
But the problem is that the users are authenticated as a group. See my
reply to Adrian Parker please.

Jacob wrote:
Actually what you want to do (since the user has succesfully logged in)
is:
Response.Redire ct(User.Identit y.Name & "_page.aspx ")

You could also have a look at the RewritePath method if you want it
more fancy.


Mar 7 '06 #5
Even if you set up the user names in the web.config file you can still
assign individual user names and passwords. The credentials element
holds a collection of user/password. So when you authenticate you can
check against this list and issue the proper authentication cookie.

Mar 7 '06 #6
That sounds great.

I don't have access to the web server right now, so I cannot test it.

So, you meant that I can do things like below?

Sub btnSubmit_Click (sender as object, e as eventargs)
If FormsAuthentica tion.Authentica te(txtUsername. text,
txtPassword.tex t) Then
If (txtUsername.Te xt = "tomcat") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("jerrymouse_ page.aspx")
Else
lblMsg.Text = "Invalid username or password"
End If
End Sub

Jacob wrote:
Even if you set up the user names in the web.config file you can still
assign individual user names and passwords. The credentials element
holds a collection of user/password. So when you authenticate you can
check against this list and issue the proper authentication cookie.


Mar 8 '06 #7
Are you going to hard-code these logic? Once you have new user, you need
change your code!

The better way is create a table in database or xml file, then lookup and
map to proper url. After that, you only need change in table.

HTH

Elton Wang

"an***********@ yahoo.com" wrote:
That sounds great.

I don't have access to the web server right now, so I cannot test it.

So, you meant that I can do things like below?

Sub btnSubmit_Click (sender as object, e as eventargs)
If FormsAuthentica tion.Authentica te(txtUsername. text,
txtPassword.tex t) Then
If (txtUsername.Te xt = "tomcat") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("jerrymouse_ page.aspx")
Else
lblMsg.Text = "Invalid username or password"
End If
End Sub

Jacob wrote:
Even if you set up the user names in the web.config file you can still
assign individual user names and passwords. The credentials element
holds a collection of user/password. So when you authenticate you can
check against this list and issue the proper authentication cookie.


Mar 8 '06 #8
That's a great point. Fortunately, I am not going to have a lot of new
users. So this silly logic would probably suffice.

But I am interested in learning to authenticate and authorize users
stored in a database.

Say, if I have a table T_User in my database that looks like this:

U_Username U_Firstname U_Lastname U_Passwd
tomcat George Bush abc123
jerrymouse Saddam Hussein 123abc

How do I authenticate these users since they are in the database? I
know how they can be authenticated and authorized in web.config, which
I just learned today. :)

Thanks.

Elton W wrote:
Are you going to hard-code these logic? Once you have new user, you need
change your code!

The better way is create a table in database or xml file, then lookup and
map to proper url. After that, you only need change in table.

HTH

Elton Wang

"an***********@ yahoo.com" wrote:
That sounds great.

I don't have access to the web server right now, so I cannot test it.

So, you meant that I can do things like below?

Sub btnSubmit_Click (sender as object, e as eventargs)
If FormsAuthentica tion.Authentica te(txtUsername. text,
txtPassword.tex t) Then
If (txtUsername.Te xt = "tomcat") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("jerrymouse_ page.aspx")
Else
lblMsg.Text = "Invalid username or password"
End If
End Sub

Jacob wrote:
Even if you set up the user names in the web.config file you can still
assign individual user names and passwords. The credentials element
holds a collection of user/password. So when you authenticate you can
check against this list and issue the proper authentication cookie.



Mar 8 '06 #9
Hope following URL is helpful to you.

http://msdn.microsoft.com/library/de...SecNetHT03.asp

"an***********@ yahoo.com" wrote:
That's a great point. Fortunately, I am not going to have a lot of new
users. So this silly logic would probably suffice.

But I am interested in learning to authenticate and authorize users
stored in a database.

Say, if I have a table T_User in my database that looks like this:

U_Username U_Firstname U_Lastname U_Passwd
tomcat George Bush abc123
jerrymouse Saddam Hussein 123abc

How do I authenticate these users since they are in the database? I
know how they can be authenticated and authorized in web.config, which
I just learned today. :)

Thanks.

Elton W wrote:
Are you going to hard-code these logic? Once you have new user, you need
change your code!

The better way is create a table in database or xml file, then lookup and
map to proper url. After that, you only need change in table.

HTH

Elton Wang

"an***********@ yahoo.com" wrote:
That sounds great.

I don't have access to the web server right now, so I cannot test it.

So, you meant that I can do things like below?

Sub btnSubmit_Click (sender as object, e as eventargs)
If FormsAuthentica tion.Authentica te(txtUsername. text,
txtPassword.tex t) Then
If (txtUsername.Te xt = "tomcat") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("tomcat_page .aspx")
Else If (txtUsername.Te xt = "jerrymouse ") Then

FormsAuthentica tion.SetAuthCoo kie(txtUsername .text, true)
Response.Redire ct("jerrymouse_ page.aspx")
Else
lblMsg.Text = "Invalid username or password"
End If
End Sub

Jacob wrote:
> Even if you set up the user names in the web.config file you can still
> assign individual user names and passwords. The credentials element
> holds a collection of user/password. So when you authenticate you can
> check against this list and issue the proper authentication cookie.


Mar 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2071
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login page that displays I have private void LinkButton1_Click(object sender, System.EventArgs e) { bool MyVar = true; Msg.Text = "ReDirecting to Home.aspx"; Response.Redirect("Home.aspx",MyVar); }
3
14045
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to enter the absolute url like response.redirect("https://myProductionServer.com/SecurePage.aspx"), because when Im working in the development server I would have to change it back and forth everytime. Is there an easy way to do this without having...
4
1630
by: Brian Lowe | last post by:
I'm using Forms authentication with my user data in a SQL db. I have pages in the main appliaction folder accessible to anonymous users and I've set security to deny annonymous users access to pages in several sub folders (e.g. admin). I've set up a login page where users trying to access any /admin/ page are diverted to and on successful login they are redirected back to the page they requested. All is well. Everything works. I want...
3
2952
by: Guadala Harry | last post by:
I need to add logic to the Page_Load event behind a site's default.aspx; that will allow either default.aspx to load - OR load a completely different page instead of default.aspx. The other pages to possibly load exist within that site. The site owner says he wants to be able to specify any of his existing pages as the site's default - and to change it whenever he wants. So I'm adding a table to the db which will hold the site's "current...
3
2629
by: William Sullivan | last post by:
Have a frameset HTML page (parent) with child .aspx pages. When each of the child pages loads, it checks to see if the user is authenticated, and if not, redirects to the login page: if(!this.Context.User.Identity.IsAuthenticated) { Response.Redirect("Login.aspx",true); } The problem is that if I go to the parent page directly, I get four versions
6
5803
by: Coleen | last post by:
Hi all :-) I need to redirect to multiple pages on click of a transmit button, without redisplaying each page. This redirection is to capture session variables that are created on each page and pass them to the main page to be displayed. We are actually NOT using session variables, but storing the values in a temporary table. The problem is that the values don't get stored in the temporary table unless the user goes to each page...
0
1555
by: Joey | last post by:
I have a web app that contains several subfolders. In one of them, I have a page set up as "Default.aspx", so users can hit it just by typing the directory name in the browser address bar (example: "http://mysite/downloads/" will bring up "http://mysite/downloads/default.aspx"). I also have several other aspx pages in the same folder. I am using these other pages in a "step-through", page-by-page fashion in order to collect data from...
2
3653
by: =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?= | last post by:
I am not sure if this is the proper forum, but I always found very helpful information here and I would like to have the advice of experts. Just before new year (end Dec 2006), my internet provided (noos.fr) had trouble with ftp, so that access to my web pages became very problematic, mostly impossible. After 2 months and many unanswered complaints, I decided to buy my own domain, subscribe with a different host and transfer all my files...
18
2668
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location: is supposed to take a fully qualified URL.
0
9624
Oralloy
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...
0
9429
jinu1996
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...
1
9383
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9295
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8295
agi2029
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...
0
6116
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();...
0
4738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3354
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
3
2243
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.