473,626 Members | 3,245 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 = "ApplicationSpe cific data for this user.";

FormsAuthentica tionTicket ticket = new
FormsAuthentica tionTicket(
1,
"my@email.c om",
System.DateTime .Now,
System.DateTime .Now.AddMinutes (1),
false,
userData,
FormsAuthentica tion.FormsCooki ePath);

// Encrypt the ticket.
string encTicket = FormsAuthentica tion.Encrypt(ti cket);

// Create the cookie.
Response.Cookie s.Add(new
HttpCookie(Form sAuthentication .FormsCookieNam e,
encTicket));

// Redirect back to original URL.
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl("my@ema il.com",false)) ;

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

<authenticati on mode="Windows" /> in the code editor.
h. Replace this found line with the following:
<authenticati on 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 1576
you cannot use Response.Redire ct with smart navigation.

-- bruce (sqlwork.com)

"aschmidt" <as******@mail. ru> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.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 = "ApplicationSpe cific data for this user.";

FormsAuthentica tionTicket ticket = new
FormsAuthentica tionTicket(
1,
"my@email.c om",
System.DateTime .Now,
System.DateTime .Now.AddMinutes (1),
false,
userData,
FormsAuthentica tion.FormsCooki ePath);

// Encrypt the ticket.
string encTicket = FormsAuthentica tion.Encrypt(ti cket);

// Create the cookie.
Response.Cookie s.Add(new
HttpCookie(Form sAuthentication .FormsCookieNam e,
encTicket));

// Redirect back to original URL.
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl("my@ema il.com",false)) ;

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

<authenticati on mode="Windows" /> in the code editor.
h. Replace this found line with the following:
<authenticati on 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.Redire ct used
FormsAuthentica tion.RedirectFr omLoginPage("my @email.com", true); the
error is still exists. The only thing is that method
RedirectFromLog inPage requires name WebForm2.aspx to Default.aspx

Nov 19 '05 #3
all RedirectFromLog inPage does is Response.Redire ct. also form
authenication uses Response.Redire ct 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.goo glegroups.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.Redire ct used
| FormsAuthentica tion.RedirectFr omLoginPage("my @email.com", true); the
| error is still exists. The only thing is that method
| RedirectFromLog inPage 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
1985
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 use JavaScript? If so, is there any code that someone can point to. And can the ASP.NET 2.0 team get this work in Mozilla....sort of targeting multiple browser like they do with other stuff already....It would be a really big boost to them,...
0
1851
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 to cause the inner page to post back, but when I turn on smart navigation, it locks up IE. I tracked it down to the actual .submit() call in javascript, then its locked up. I set a couple of hidden form elements that I use for tracking, then...
1
1652
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 it to our webserver the pages that have smart navigation do not show up... I have even copied aspnet_client folder to the root of the website and it still does not work. I am still working in 1.0 version.
10
1708
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 Smartnav.js? htmlfile: Invalid pointer. it is occuring on line 79 hdm.appendChild(k);
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 now smart navigation doesn't even "turn on". So I was wondering if there were any examples of other methods out there to recieve the same effect of smart navigation. Can anyone possibly provide sample source code in VB.NET? THank Devin
3
2403
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 turned on and it works fine running the application on my browser. However, if I copy the application to our build server, and run the application from that server, Smart Navigation doesn't work. When you select let's say a combo box value, the...
1
1329
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 event is occured due to a dropdownlist, all my styles applied to the entire form is dissappeared, this occured only after enabling the Smart Navigation,
3
1515
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 like this: function onload() { <% if (some_condition) { %> do_some_javascript(); <% } %>
0
1204
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 postbacks when smart navigation is applied results in internet explorer not applying the style sheet. Has anyone else had this problem and found a solution as at the moment I've had to disable smart navigation on the page.
0
8203
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,...
0
8711
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
8642
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...
0
7203
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...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4094
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...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
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
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.