473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

access to user.identity.name?

Hello,

I've got a text-based .inc file that I'm using for my asp.net site's header.
I thought about a user control, but if possible, I'd like to avoid it for
simplicity's sake. In the main page, I do a response.writefile("header.inc")
for inserting the header. I have one render block:
<%= User.Identity.Name %>

Unfortunately, it seems that this is outputted as literal text to the
browser. I've tried a user control, but it doesn't seem to let me access this
property from the context of the user control. Is there any way to achieve
what I'm trying to do, ideally in the .inc, but via a user control would be
acceptable as well... ? Thanks for any help...

-Ben
Jul 21 '05 #1
4 1721
Can you give more info on what your exact intended purpose is?

If you are trying to dump a string into the header of your page, how about a
label control. Then in code for page.load, set the text for the label

me.label1.text = user.identity.name

"Ben R." wrote:
Hello,

I've got a text-based .inc file that I'm using for my asp.net site's header.
I thought about a user control, but if possible, I'd like to avoid it for
simplicity's sake. In the main page, I do a response.writefile("header.inc")
for inserting the header. I have one render block:
<%= User.Identity.Name %>

Unfortunately, it seems that this is outputted as literal text to the
browser. I've tried a user control, but it doesn't seem to let me access this
property from the context of the user control. Is there any way to achieve
what I'm trying to do, ideally in the .inc, but via a user control would be
acceptable as well... ? Thanks for any help...

-Ben

Jul 21 '05 #2
In a user control, use System.Web.httpContext.Current to access the
properties of the current HTTP request (Request,Response,Session etc...)

--

"Ben R." <Be**@discussions.microsoft.com> a écrit dans le message de
news:06**********************************@microsof t.com...
Hello,

I've got a text-based .inc file that I'm using for my asp.net site's header. I thought about a user control, but if possible, I'd like to avoid it for
simplicity's sake. In the main page, I do a response.writefile("header.inc") for inserting the header. I have one render block:
<%= User.Identity.Name %>

Unfortunately, it seems that this is outputted as literal text to the
browser. I've tried a user control, but it doesn't seem to let me access this property from the context of the user control. Is there any way to achieve
what I'm trying to do, ideally in the .inc, but via a user control would be acceptable as well... ? Thanks for any help...

-Ben

Jul 21 '05 #3
Thanks for the tip, Patrice. That's just what I was looking for. Out of
curiosity, why is it that I can't intrinsicly access the current httpcontext
from the user control, since the user control is placed on the main page? I
don't need to request the current httpcontext on the main page. Just
wondering. Thanks for the tip...

-Ben

"Patrice" wrote:
In a user control, use System.Web.httpContext.Current to access the
properties of the current HTTP request (Request,Response,Session etc...)

--

"Ben R." <Be**@discussions.microsoft.com> a écrit dans le message de
news:06**********************************@microsof t.com...
Hello,

I've got a text-based .inc file that I'm using for my asp.net site's

header.
I thought about a user control, but if possible, I'd like to avoid it for
simplicity's sake. In the main page, I do a

response.writefile("header.inc")
for inserting the header. I have one render block:
<%= User.Identity.Name %>

Unfortunately, it seems that this is outputted as literal text to the
browser. I've tried a user control, but it doesn't seem to let me access

this
property from the context of the user control. Is there any way to achieve
what I'm trying to do, ideally in the .inc, but via a user control would

be
acceptable as well... ? Thanks for any help...

-Ben


Jul 21 '05 #4
You can also AFAIK. You have a Page property that allows to access to the
hosting page and in particular to the User property. Other information may
be reachable directly (such as Session).

I wanted to point on the original problme rahter to have to use include
files as a workaround...

Patrice
--

"Ben R." <Be**@discussions.microsoft.com> a écrit dans le message de
news:3D**********************************@microsof t.com...
Thanks for the tip, Patrice. That's just what I was looking for. Out of
curiosity, why is it that I can't intrinsicly access the current httpcontext from the user control, since the user control is placed on the main page? I don't need to request the current httpcontext on the main page. Just
wondering. Thanks for the tip...

-Ben

"Patrice" wrote:
In a user control, use System.Web.httpContext.Current to access the
properties of the current HTTP request (Request,Response,Session etc...)

--

"Ben R." <Be**@discussions.microsoft.com> a écrit dans le message de
news:06**********************************@microsof t.com...
Hello,

I've got a text-based .inc file that I'm using for my asp.net site's

header.
I thought about a user control, but if possible, I'd like to avoid it for simplicity's sake. In the main page, I do a

response.writefile("header.inc")
for inserting the header. I have one render block:
<%= User.Identity.Name %>

Unfortunately, it seems that this is outputted as literal text to the
browser. I've tried a user control, but it doesn't seem to let me access
this
property from the context of the user control. Is there any way to
achieve what I'm trying to do, ideally in the .inc, but via a user control

would be
acceptable as well... ? Thanks for any help...

-Ben


Jul 21 '05 #5

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

Similar topics

42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
2
by: Brent Burkart | last post by:
I am trying to send an email using SMTP server through IIS. I am recieving the following error. Access is denied. Description: An unhandled exception occurred during the execution of the...
5
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
1
by: Veeresh | last post by:
I am getting the following error message. I have logged into the system using my user name into the network. How to find out in which account ASP.Net is running?
5
by: tshad | last post by:
I am trying to access my log files and am running into a permissions problem. I am doing the following: ****************************************************************** private void...
1
by: Jody Gelowitz | last post by:
We are having an issue in that when trying to read a file that is on Server2 from Server1 (through our ASP.NET project), we receive the error: Access to the path "\\Server2\MyShare\MyFile.tif" is...
11
by: Eric | last post by:
Hello, I have a web app that uploads files to a file server (different box than the web server). The application uses NT integrated authentication, but no users should have permissions to the...
1
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA...
2
by: =?Utf-8?B?RWRkaWU=?= | last post by:
Here is my scenario for a problem I can't solve. I am hosting a 3.5 WCF service in IIS on Windows Server 2003. The service works fine with the WCF test client in Visual Studio 2008 and from an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.