Ryan98034
06-08-2004, 12:16 PM
I am programming in Visual Studio .NET 2003 and using ASPX web forms. I have searched but cannot find any help on how to navigate to different web form. I put a link on the web page and know how to change pages that way...But I am authenticating a user and then want to open a webpage if the user is authentic.
Another question: I am authenticating by just making a connection to the database using the user and pass supplied. Is there a better way?
Thanks,
Ryan
CrZyAsMHaCkeR
06-08-2004, 01:53 PM
If I read your post correctly, use the Refresh of Location HTTP headers to redirect users to different web pages automatically. The difference between Refresh and Location is that Refresh allows you to supply a timeout.
Location: http://yoursite/yourpage.aspx
or
Refresh: 3; url=http://yoursite/yourpage.aspx
I believe this is the way you do it in ASP.NET:
Response.AppendHeader("Location", "http://yoursite/yourpage.aspx");
or
Response.AppendHeader ("Refresh", "http://yoursite/yourpage.aspx");
banner
06-08-2004, 11:27 PM
You can also use Server.Transfer("newUrl"), Server.Execute ("newUrl") and I believe there are 2 or 3 other ways of doing this without writing any HTTP headers back to the client. I would recommend looking into examples of using "Forms" authentication. It is basically what it sounds like you are trying to do and the samples should show you how to accomplish it.
Ryan98034
06-09-2004, 12:18 AM
server.transfer worked like a charm!!! Thanks! I'm new to this and have a steep learning curve ahead of me. Now I have to figure out how to pass objects to another page...(or just use information entered from the previous page)
Ryan
Learning is fun :)
banner
06-09-2004, 02:09 AM
You can store information in the Context object for use with Server.Transfer. There should also be a flag you can set so that the Forms collection is passed to the new page.
mwaseem
06-09-2004, 06:21 AM
Now I have to figure out how to pass objects to another page
There are many ways to store the information for later use. you can use
1. Cookies
2. Session Variables
3. Form's hidden fields
Cookies is not recommended.
If you chose 3, you'll have to create a form on every page with some Hidden fields and setting their values to the posted information.
I recommend to use Session Variables.
Advantage of storing information in session variables is that you just have to remember the variable name and use it.
kajakske
06-10-2004, 10:24 AM
Make note that Server.Transfer does not change the address bar in your browser.
Page.Response.Redirect() does ...
mwaseem
06-11-2004, 01:56 AM
Because Server.Transfer() just behaves like a function call (open the file, execute the code, and continue to the next line), while Response.Redirect("script.asp") transfers the client to 'script.asp'.