![]() |
|
|
|
#1 |
|
hi,
i'm trying to write out the currently logged on user with the following code, however it doesn't write anything when run in the browser. any ideas? thanks, ----------------------------------------------------- public string test = ""; private void Page_Load(object sender, System.EventArgs e) { test += User.Identity.Name; test += WindowsIdentity.GetCurrent().Name + " is the user"; } ----------------------------------------------------- <div id="center"><% = test %></div> ----------------------------------------------------- Mark |
|
|
|
|
#2 |
|
Posts: n/a
|
Perhaps you may want to try an alternative to the old ASP <%= %> write tags. Try databinding tags <%# %> instead. This way, you can control when the string is written to the page by calling this.DataBind().
public string test = ""; private void Page_Load(object sender, System.EventArgs e) { test += User.Identity.Name; test += WindowsIdentity.GetCurrent().Name + " is the user"; this.DataBind(); } <div id="center"><%# test %></div> Joe Agster www.geekyfrog.com ----- Mark wrote: ----- public string test = ""; private void Page_Load(object sender, System.EventArgs e) { test += User.Identity.Name; test += WindowsIdentity.GetCurrent().Name + " is the user"; } hi, i'm trying to write out the currently logged on user with the following code, however it doesn't write anything when run in the browser. any ideas? thanks, ----------------------------------------------------- ----------------------------------------------------- <div id="center"><% = test %></div> ----------------------------------------------------- =?Utf-8?B?Sm9lIEFnc3Rlcg==?= |
|
|
|
#3 |
|
Posts: n/a
|
Take a look at this:
http://www.4guysfromrolla.com/webtech/092298-3.shtml I think the way you are going about this will give you the user that ASP.net is running as. Michael "Mark" <> wrote in message news: om... > hi, > > i'm trying to write out the currently logged on user with the > following code, however it doesn't write anything when run in the > browser. > any ideas? > thanks, > > ----------------------------------------------------- > public string test = ""; > > private void Page_Load(object sender, System.EventArgs e) > { > test += User.Identity.Name; > test += WindowsIdentity.GetCurrent().Name + " is the user"; > } > ----------------------------------------------------- > > <div id="center"><% = test %></div> > ----------------------------------------------------- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.573 / Virus Database: 363 - Release Date: 1/28/2004 Michael Pearson |
|
|
|
#4 |
|
Posts: n/a
|
thanks for the tip, but it still refuses to output the text from the
test variable to the page. Tried setting a breakpoint in vs.net to see what was stored int he variable but the debugger didn't break at that line. Seems to not even execute the Page_load? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Mark - |
|
|
|
#5 |
|
Posts: n/a
|
That page seems to be for asp, asp.net is ment to give you
User.Identity.Name; or WindowsIdentity.GetCurrent().Name; to get the username, but both i've found have been doing doing nothing. public string test ="is the user"; <-- will output "is the user" however, the following outputs nothing, not even the "is the user" part of the string. any ideas? thanks, ------- public string test = ""; ------ on_page_load--------- test += User.Identity.Name; test += WindowsIdentity.GetCurrent().Name + " is the user"; --------------------- *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Mark - |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CISCO 1801 DNS problem | marsav | Hardware | 2 | 07-05-2009 11:41 PM |
| Different types of video output - I'm confused | robotiser@googlemail.com | DVD Video | 2 | 07-29-2007 04:25 PM |
| Post-Route Simulation does not give output for the first clock cycle Options | velocityreviews | Software | 0 | 04-17-2007 05:47 PM |
| Sony Precision Cinema Progressive Output vs Component 480p Output | Otto Pylot | DVD Video | 1 | 04-18-2004 10:49 PM |
| Panasonic S25 DVD player w/o S-video output - will its replacement have S-video? | Mark | DVD Video | 1 | 02-11-2004 04:19 PM |