473,508 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another bug in smart navigation.

Another bug in smart navigation. If smartnavigation is enabled in the
page and session
timeout occurs, the framework redirects you to wrong location of
login.aspx page if you
use Forms Authentication.

Steps to reproduce.

1. Create new web project in Visual Studio
a. Go to File | New | Project Е
b. Leave default name of project as this:
http://localhost/WebApplication1
2. Create default page.
a. Go to WebForm1.aspx in Solution Explorer (press Ctrl+Alt+L to open

Solution Explorer).
b. Create three controls in the page namely Label, TextBox and a
Button.
Leave default names.
c. Double-click Button to create default OnClick method. This opens
source
code for web-form and steps to Button1_Click method.
d. Add one statement in the Button1_Click method:
Label1.Text = TextBox1.Text;
e. Set smartNavigation property of the page to True.
f. Run project and enter anything into TextBox on the page. Click
Button,
this should change label text with value you entered in TextBox.
This
confirms the page is working property.
3. Activate forms authentication mechanism for the project.
a. Create new web-form in the project
i. Click on WebApplication1 in Solution Explorer and select Add |

Add Web Form Е. This will create new web-form.
ii. Set name of this page to login.aspx.
b. Go to design view of login.aspx
c. Put two TextBox controls and a Button. These two textboxes will
represent Username and Password fields.
d. Change Button1 text to Login.
e. Double-click login Button to create default OnClick method. This
opens
source code for web-form and steps to Button1_Click method. Insert
the
following in to Button1_Click method:

string userData = "ApplicationSpecific data for this user.";

FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(
1,
"my@email.com",
System.DateTime.Now,
System.DateTime.Now.AddMinutes(1),
false,
userData,
FormsAuthentication.FormsCookiePath);

// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);

// Create the cookie.
Response.Cookies.Add(new
HttpCookie(FormsAuthentication.FormsCookieName,
encTicket));

// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl("my@email.com",false));

f. Add using line in login.aspx.cs: using System.Web.Security; This
reference is required for Button1_Click code.
g. Double-click on Web.config in the Solution Explorer and find line:

<authentication mode="Windows" /> in the code editor.
h. Replace this found line with the following:
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
i. Find line <allow users="*" /> in web.config and replace it with:
<deny users="?"/>
j. Find sessionState section in web.config and set timeout value to
1.
This will set timeout to 1 minute on inactivity.
k. Run project and see the behavior. If you are trying to reach
WebForm1.aspx you will be redirected to login.aspx page. After
entering
username/password and click on Login button you'll be redirected
to
"real" site, which is WebForm1.aspx in this case.
4. Create sub-folder and web-form in this sub-folder.
a. Go to WebApplication1 in Solution Explorer and in context menu,
invoked by right-click, select Add | New Folder command. Rename.
b. Drag and drop existing WebForm1.aspx into NewFolder1. The web-page

should appear under NewFolder.
5. Create new "default" web-page and add hyperlink to WebForm1.aspx
located
under subfolder.
a. Right click on WebApplication1 in Solution Explorer and select Add
|
Add New Form command. This should create WebForm1.aspx.
b. Right click on WebForm1.aspx and select Set As Start Page command.

This should make this page as default page of the application.
c. Double-click on WebForm2.aspx to open this page in design view.
Add
Hyperlink control from Toolbox
d. Change NavigateUrl value of Hyperlink1 control to
NewFolder1/WebForm1.aspx
6. Run project. You should be redirected to login.aspx page. Enter any
values into
two textboxes those represent our username/password and click Login
button.
This should redirect to "default" page WebForm2.aspx.
7. Click on Hyperlink link. This will open NewFolder1/WebForm1.aspx
page.
8. Wait a bit more than one minute which will timeout the session.
Click on button
and see the behavior. You should be redirected to
WebApplication1/login.aspx
page, but the location in Address line in browser hasn't being
changed while
login.aspx is rendered in the browser.
9. Enter username/password and click Login. You will see request to
WebApplication1/NewFolder1/login.aspx or popup message Connect to
<localhost> with username/password prompt, which is incorrect. You
should be
redirected to WebApplication1/login.aspx.
10. Set smartNavigation property of WebForm1.aspx back to False and
check that
you will be redirected to right location once the session timeout.

Nov 19 '05 #1
4 1567
you cannot use Response.Redirect with smart navigation.

-- bruce (sqlwork.com)

"aschmidt" <as******@mail.ru> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Another bug in smart navigation. If smartnavigation is enabled in the
page and session
timeout occurs, the framework redirects you to wrong location of
login.aspx page if you
use Forms Authentication.

Steps to reproduce.

1. Create new web project in Visual Studio
a. Go to File | New | Project ?
b. Leave default name of project as this:
http://localhost/WebApplication1
2. Create default page.
a. Go to WebForm1.aspx in Solution Explorer (press Ctrl+Alt+L to open

Solution Explorer).
b. Create three controls in the page namely Label, TextBox and a
Button.
Leave default names.
c. Double-click Button to create default OnClick method. This opens
source
code for web-form and steps to Button1_Click method.
d. Add one statement in the Button1_Click method:
Label1.Text = TextBox1.Text;
e. Set smartNavigation property of the page to True.
f. Run project and enter anything into TextBox on the page. Click
Button,
this should change label text with value you entered in TextBox.
This
confirms the page is working property.
3. Activate forms authentication mechanism for the project.
a. Create new web-form in the project
i. Click on WebApplication1 in Solution Explorer and select Add |

Add Web Form ?. This will create new web-form.
ii. Set name of this page to login.aspx.
b. Go to design view of login.aspx
c. Put two TextBox controls and a Button. These two textboxes will
represent Username and Password fields.
d. Change Button1 text to Login.
e. Double-click login Button to create default OnClick method. This
opens
source code for web-form and steps to Button1_Click method. Insert
the
following in to Button1_Click method:

string userData = "ApplicationSpecific data for this user.";

FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(
1,
"my@email.com",
System.DateTime.Now,
System.DateTime.Now.AddMinutes(1),
false,
userData,
FormsAuthentication.FormsCookiePath);

// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);

// Create the cookie.
Response.Cookies.Add(new
HttpCookie(FormsAuthentication.FormsCookieName,
encTicket));

// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl("my@email.com",false));

f. Add using line in login.aspx.cs: using System.Web.Security; This
reference is required for Button1_Click code.
g. Double-click on Web.config in the Solution Explorer and find line:

<authentication mode="Windows" /> in the code editor.
h. Replace this found line with the following:
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
i. Find line <allow users="*" /> in web.config and replace it with:
<deny users="?"/>
j. Find sessionState section in web.config and set timeout value to
1.
This will set timeout to 1 minute on inactivity.
k. Run project and see the behavior. If you are trying to reach
WebForm1.aspx you will be redirected to login.aspx page. After
entering
username/password and click on Login button you'll be redirected
to
"real" site, which is WebForm1.aspx in this case.
4. Create sub-folder and web-form in this sub-folder.
a. Go to WebApplication1 in Solution Explorer and in context menu,
invoked by right-click, select Add | New Folder command. Rename.
b. Drag and drop existing WebForm1.aspx into NewFolder1. The web-page

should appear under NewFolder.
5. Create new "default" web-page and add hyperlink to WebForm1.aspx
located
under subfolder.
a. Right click on WebApplication1 in Solution Explorer and select Add
|
Add New Form command. This should create WebForm1.aspx.
b. Right click on WebForm1.aspx and select Set As Start Page command.

This should make this page as default page of the application.
c. Double-click on WebForm2.aspx to open this page in design view.
Add
Hyperlink control from Toolbox
d. Change NavigateUrl value of Hyperlink1 control to
NewFolder1/WebForm1.aspx
6. Run project. You should be redirected to login.aspx page. Enter any
values into
two textboxes those represent our username/password and click Login
button.
This should redirect to "default" page WebForm2.aspx.
7. Click on Hyperlink link. This will open NewFolder1/WebForm1.aspx
page.
8. Wait a bit more than one minute which will timeout the session.
Click on button
and see the behavior. You should be redirected to
WebApplication1/login.aspx
page, but the location in Address line in browser hasn't being
changed while
login.aspx is rendered in the browser.
9. Enter username/password and click Login. You will see request to
WebApplication1/NewFolder1/login.aspx or popup message Connect to
<localhost> with username/password prompt, which is incorrect. You
should be
redirected to WebApplication1/login.aspx.
10. Set smartNavigation property of WebForm1.aspx back to False and
check that
you will be redirected to right location once the session timeout.
Nov 19 '05 #2
There are three pages in the repro:
login.aspx
WebForm1.aspx
WebForm2.aspx

Only one page, WebForm1.aspx located under NewFolder1 folder has
SmartNavigation enabled and has nothing to do with login sequence. The
native popup window with username/password is raised before it reaches
ASP.NET server engine.

If instead Response.Redirect used
FormsAuthentication.RedirectFromLoginPage("my@emai l.com", true); the
error is still exists. The only thing is that method
RedirectFromLoginPage requires name WebForm2.aspx to Default.aspx

Nov 19 '05 #3
all RedirectFromLoginPage does is Response.Redirect. also form
authenication uses Response.Redirect to get to the login page.

you can put client code on the login page to detect its in a iframe (called
from a smart nav page). and navigate the top page to the login page.

-- bruce (sqlwork.com)
"aschmidt" <as******@mail.ru> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
| There are three pages in the repro:
| login.aspx
| WebForm1.aspx
| WebForm2.aspx
|
| Only one page, WebForm1.aspx located under NewFolder1 folder has
| SmartNavigation enabled and has nothing to do with login sequence. The
| native popup window with username/password is raised before it reaches
| ASP.NET server engine.
|
| If instead Response.Redirect used
| FormsAuthentication.RedirectFromLoginPage("my@emai l.com", true); the
| error is still exists. The only thing is that method
| RedirectFromLoginPage requires name WebForm2.aspx to Default.aspx
|
Nov 19 '05 #4
Yes, I implemented this workaround and it works. Thanks for comments.

Nov 19 '05 #5

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

Similar topics

6
1964
by: anon | last post by:
How *EXACTLY* does Smart Navigation work? (I would really really really like for this Smart Navigation to work in Mozilla.) The inner workings and the code is what I am looking for. Does it...
0
1842
by: Jason Rodman | last post by:
I have been working on a web app that uses IFrames for our edit screens. A main window contains static information, while an IFrame contains the editable page. I use javascript from the outer page...
1
1651
by: Sal | last post by:
Greetings to all... I have a simple asp.net app. It consists of three aspx pages. I have enabled smart navigation on the pages. The app runs smoothly on the developer machine, but when I upload...
10
1692
by: RodBillett | last post by:
Using SmartNavigation. Windows2003 Server Framework 1.0 (3705) IIS6 and I have IIS configured to utilize the 1.0 framework. Any Ideas why I would be getting the following jscript error within...
1
314
by: Devin | last post by:
I am having a problem of SmartNavigation, wher eit works fine on the test server, but not on the server that I load it up to. I tried placing "page.smartnavigation=false" right before I redirect, but...
3
2382
by: Lee Forst | last post by:
I have looked through tons of posts and I have not found a clear cut answer to my problem. Here is the problem. On my localhost, I have a ASP.NET application that has Smart Navigation...
1
1311
by: thomson | last post by:
Hi all, i have enabled Smart Navigation in the Page attribute, My Webform has several Webform controls, all applied with style sheets from an external file. Problem --------- When a postback...
3
1506
by: ajfish | last post by:
Hi, I have a web form with smart navigation turned on. the html has an onload event which calls a javascript function and the contents of this function are dynamically generated on the server...
0
1197
by: keeper | last post by:
Recently a new windows update for internet explorer was released which seems to have broken stylesheets with smart navigation. The first request for the page works fine, but any subsequent...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
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...
0
7383
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...
0
7498
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...
0
5627
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,...
0
4707
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...
0
3194
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
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 ...

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.