•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,874 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,998 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 151268 | Replies: 74 | Solved
![]() |
•
•
Join Date: May 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
Originally Posted by Kendel
I think what he asked was:
Instead of
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page! ,
can he use, Reponse.Redirect
The answer is Yes. Response.Redirect will do the work.
In my application I also use Response.Redirect("MainMenu.apsx"). Once user
is verified and logged in then I present the main menu to the user.
I did not understand the reasoning behind FormsAuthentication.RedirectFromLoginPage() also? even after reading explanation above as well as online help
Paladine,
You are absolutely GREAT! I am a complete NEWBIE in .NET world programming. I have previous experience in C programming. Your Tutorial was extremely helpful to get someone like me started on .NET.
Infect, I was using the newer 2005 Express Edition .NET version and still everything worked. Only problem I faced was web.config was different, but,
with little more reading and debugging it got fixed.
What I still do not understand is Global.asax ? Waht is *.asax file extension? Can you list complete listing of Global.asax? In the forum, there was only one time mention of this file and that was it. I could not find anything more about it.
I also would like to add limited login attempt and set session LOGIN_IN = "YES". Help in section with little detail will be greatful.
Finally,
Paladine you are the GREATEST!
Thank you,
Thanks for the praise. Greatly appreciated, and I am glad this tutorial helped.
:p
The reason I did not get into the details of the Global.asax file or web.config, was for time, and to avoid confusion.
But since you asked I will answer your questions about them, and clear up the Response.Redirect query.
You can certainly use the method you have chosen for the Response.Redirect means of sending the user to the next page in the application. I chose to use FormsAuthentication.RedirectFromLoginPage() since it is part of the security namespace in the .net framework, and because that was then idea behind the tutorial; Security.
So for future use with things like and Authentication Ticket. encryption, and/or a Cookie. All for security (tighter). So you can use any other means you want to redirect the user. It is just the method I picked for the tutorial theme.
Global.asax file is known as the ASP.NET Application File. This file allows you to program against the HttpApplication Object - you can control the ASP.NET application as you do any other object through methods and events
...." controls application events, allowing you to execute code the first time any page in your application is requested, or even every time the page is requested"
So when ever a page in your virtual directory is requested for the first time, an HttpApplication object is instantiated.
See here for members of the this Class
Web.Config
- It holds the information used by the application to control its behavior.
- Nothing special about this file, except it does hold keys and values recognized by ASP.NET
<appSettings> - Used to store your own custom application settings
<authenication> - Configures how ASP.NET authenicates users
<browsercaps> - Responsible for controlling the settings of the browser capabilities component.

:p
The reason I did not get into the details of the Global.asax file or web.config, was for time, and to avoid confusion.
But since you asked I will answer your questions about them, and clear up the Response.Redirect query.
You can certainly use the method you have chosen for the Response.Redirect means of sending the user to the next page in the application. I chose to use FormsAuthentication.RedirectFromLoginPage() since it is part of the security namespace in the .net framework, and because that was then idea behind the tutorial; Security.
So for future use with things like and Authentication Ticket. encryption, and/or a Cookie. All for security (tighter). So you can use any other means you want to redirect the user. It is just the method I picked for the tutorial theme.
Global.asax file is known as the ASP.NET Application File. This file allows you to program against the HttpApplication Object - you can control the ASP.NET application as you do any other object through methods and events
...." controls application events, allowing you to execute code the first time any page in your application is requested, or even every time the page is requested"
So when ever a page in your virtual directory is requested for the first time, an HttpApplication object is instantiated.
See here for members of the this Class
Web.Config
- It holds the information used by the application to control its behavior.
- Nothing special about this file, except it does hold keys and values recognized by ASP.NET
<appSettings> - Used to store your own custom application settings
<authenication> - Configures how ASP.NET authenicates users
<browsercaps> - Responsible for controlling the settings of the browser capabilities component.
- As for the response to setting a limited number of attempts to login, I have already shown that with the session variable(s).

•
•
•
•
Originally Posted by spatelone
In my application I also use Response.Redirect("MainMenu.apsx"). Once user
is verified and logged in then I present the main menu to the user.
I did not understand the reasoning behind FormsAuthentication.RedirectFromLoginPage() also? even after reading explanation above as well as online help![]()
Paladine,
You are absolutely GREAT! I am a complete NEWBIE in .NET world programming. I have previous experience in C programming. Your Tutorial was extremely helpful to get someone like me started on .NET.
Infect, I was using the newer 2005 Express Edition .NET version and still everything worked. Only problem I faced was web.config was different, but,
with little more reading and debugging it got fixed.
What I still do not understand is Global.asax ? Waht is *.asax file extension? Can you list complete listing of Global.asax? In the forum, there was only one time mention of this file and that was it. I could not find anything more about it.
I also would like to add limited login attempt and set session LOGIN_IN = "YES". Help in section with little detail will be greatful.
Finally,
Paladine you are the GREATEST!
Thank you,
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: May 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 1
Paladine,
Is there anyway I can use FormsAuthentication.RedirectFromLoginPage() and specify a page name that I want to go to?, i.e., MainMenu.aspx? or am I stuck with default.aspx only?
Also, the above function is used here because we are discussing login. But, what functions you recommend instead of Response.Redirect() to go back and forth between other web pages? For Example, assume I rename my MainMenu.aspx to default.aspx. If user click on menu option then I need to go to that page and load. Will Response.Redirect() be good or another function?
I am looking for good books for refrences as well as "How To" series books on .NET with database and VB. Any suggestion?
Thank you!
P. S. You should think about writing book on .net and VB
Is there anyway I can use FormsAuthentication.RedirectFromLoginPage() and specify a page name that I want to go to?, i.e., MainMenu.aspx? or am I stuck with default.aspx only?
Also, the above function is used here because we are discussing login. But, what functions you recommend instead of Response.Redirect() to go back and forth between other web pages? For Example, assume I rename my MainMenu.aspx to default.aspx. If user click on menu option then I need to go to that page and load. Will Response.Redirect() be good or another function?
I am looking for good books for refrences as well as "How To" series books on .NET with database and VB. Any suggestion?
Thank you!
P. S. You should think about writing book on .net and VB
•
•
Join Date: May 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 1
Paladine,
Please help me clear some confusion about the page that is executed in webserver wether is IIS or another webserver. Hopefully this is going to help me understand Response.Redirect() vs. FormsAuthentication.RedirectFromLoginPage().
In any webserver one can only define one (1) main file, i.e., *.htm, *.aspx, etc, which is loaded whenever a client, i.e., internet explorer, connects.
Suppose I specify login2.aspx as that main page so whenever any of my user enters URL of my website then their browser will automatically load login page.
Now then, upon successful login it seems to me that I have to use Response.Redirect() to move that user to next page. Because if I use FormsAuthentication.RedirectFromLoginPage() then server is looking for default.aspx. I can't set default.aspx as default document as stated in earlier post, because I already have login2.aspx as my default document.
I am sorry I am having difficulty explain my problem properly. But, eventually I am trying to use FormsAuthentication.RedirectFromLoginPage() after user successfully logs in, however, I can't seems to do it without using Response.Redirect() because I want to move to page name MainMenu.aspx and not default.aspx.
Again, I hope I've explained my problem properly and you'll see my perspective to you can help me.
As always you're GREATTTTTTTTTT!
Thank you,
Please help me clear some confusion about the page that is executed in webserver wether is IIS or another webserver. Hopefully this is going to help me understand Response.Redirect() vs. FormsAuthentication.RedirectFromLoginPage().
In any webserver one can only define one (1) main file, i.e., *.htm, *.aspx, etc, which is loaded whenever a client, i.e., internet explorer, connects.
Suppose I specify login2.aspx as that main page so whenever any of my user enters URL of my website then their browser will automatically load login page.
Now then, upon successful login it seems to me that I have to use Response.Redirect() to move that user to next page. Because if I use FormsAuthentication.RedirectFromLoginPage() then server is looking for default.aspx. I can't set default.aspx as default document as stated in earlier post, because I already have login2.aspx as my default document.
I am sorry I am having difficulty explain my problem properly. But, eventually I am trying to use FormsAuthentication.RedirectFromLoginPage() after user successfully logs in, however, I can't seems to do it without using Response.Redirect() because I want to move to page name MainMenu.aspx and not default.aspx.
Again, I hope I've explained my problem properly and you'll see my perspective to you can help me.
As always you're GREATTTTTTTTTT!
Thank you,
Thanks for the compliments. I am just glad I can help. :mrgreen:
Well I hope I can clear some things up for you:
FormsAuthentication is a means for authenticating through your asp.net application, rather than IIS. This gives you more control over your site's authenication scenarious. For example, if you store your users' credentials in a database or xml file instead of through windows.
:lol:
Looking at the methods of the FormsAuthenication Class will give you a better idea of what functionality it provides. That functionality is on a different playing field from Response.Redirect.
Response.Redirect is simple a means of redirecting a user, it in no way allows you to set security options in your application based on that redirection like FormsAuthenication does. Saying that, this does not mean you can't combine the two. ??
Example:
You set up a cookie, and then redirect the user. I choose FormsAuthentication.RedirectFromLoginPage for my examples as just another way to do this redirection, and have the application redirect the user for me, based on the default page setup on the webserver.
http://www3.telus.net/public/tmlohnes/Image1.jpg
So you could easily add Login2.aspx as a possible default page, but you dont want to do this for every case, so use Reponse.Redirect(). Nothing saying you can't do it that way, just cumbersome to add pages to the default list that the webserver looks for. Make sense?
So in your case, I would use the Response.Redirect !
Hope this helps!
Well I hope I can clear some things up for you:
FormsAuthentication is a means for authenticating through your asp.net application, rather than IIS. This gives you more control over your site's authenication scenarious. For example, if you store your users' credentials in a database or xml file instead of through windows.
:lol:
Looking at the methods of the FormsAuthenication Class will give you a better idea of what functionality it provides. That functionality is on a different playing field from Response.Redirect.
Response.Redirect is simple a means of redirecting a user, it in no way allows you to set security options in your application based on that redirection like FormsAuthenication does. Saying that, this does not mean you can't combine the two. ??
Example:
if txtUserName.Text = "Test" then
FormsAuthenication.SetAuthCookie (txtUserName.Text, false)
Response.Redirect ("MyMainMenu.aspx")
end ifYou set up a cookie, and then redirect the user. I choose FormsAuthentication.RedirectFromLoginPage for my examples as just another way to do this redirection, and have the application redirect the user for me, based on the default page setup on the webserver.
http://www3.telus.net/public/tmlohnes/Image1.jpg
So you could easily add Login2.aspx as a possible default page, but you dont want to do this for every case, so use Reponse.Redirect(). Nothing saying you can't do it that way, just cumbersome to add pages to the default list that the webserver looks for. Make sense?
So in your case, I would use the Response.Redirect !
Hope this helps!
•
•
•
•
Originally Posted by spatelone
Paladine,
Please help me clear some confusion about the page that is executed in webserver wether is IIS or another webserver. Hopefully this is going to help me understand Response.Redirect() vs. FormsAuthentication.RedirectFromLoginPage().
In any webserver one can only define one (1) main file, i.e., *.htm, *.aspx, etc, which is loaded whenever a client, i.e., internet explorer, connects.
Suppose I specify login2.aspx as that main page so whenever any of my user enters URL of my website then their browser will automatically load login page.
Now then, upon successful login it seems to me that I have to use Response.Redirect() to move that user to next page. Because if I use FormsAuthentication.RedirectFromLoginPage() then server is looking for default.aspx. I can't set default.aspx as default document as stated in earlier post, because I already have login2.aspx as my default document.
I am sorry I am having difficulty explain my problem properly. But, eventually I am trying to use FormsAuthentication.RedirectFromLoginPage() after user successfully logs in, however, I can't seems to do it without using Response.Redirect() because I want to move to page name MainMenu.aspx and not default.aspx.
Again, I hope I've explained my problem properly and you'll see my perspective to you can help me.
As always you're GREATTTTTTTTTT!
Thank you,
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the ASP.NET Forum
- Previous Thread: ASP.Net Directory Problems
- Next Thread: Ready to take up a challenge

Linear Mode