Monday, March 26, 2012

Please help

Hello I have created a login page using the login page form. After a user logs in I re-direct the user to the protected page by using the following

FormsAuthentication.RedirectFromLoginPage(UserName.selecteditem.value, true). The user is then redirected to a new page default.aspx. On this page I want unique information related to this users username. How do I do this ? EG it should display only accounts related to this user from the accounts database. How do I pass the username from the Login page to this page? or should I get it from the cookies? If so how?Just need to know how to get the login name from Login.aspx to default.aspx

Thanks

GrantHave you treid giving
Response.Write(user.Identity.Name)?
Test.
Hi!

I would like to know where should one give the Response.Write(user.Identity.Name)?

in the login.aspx or default.aspx file. As it does not work for me both ways.

Thanks
Do you have

 <identity impersonate="true" />
line in your web.config
try giving this and check if you get user name
Hi Sushila,

Thanks for your quick response. I was unable to execute the program and get a runtime error. This stops me from doing anything.

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Your help will be appreciated.

Thanks

Sukumar
Are you enclosing this tag within


<system.web>
.....
<identity impersonate="true" />
</system.web>

Even without giving this tag <identity impersonate="true" /> User.Identity.Name works

SuKumar : can u paste the error that is shows when u give
Response.Write(User.Identity.Name)

0 comments:

Post a Comment