ASP web form guidance.

T

Tim Marsden

Hi,

Please excuse me, I am complete ASP novice. I use VB.NET in VS 2003.

I am trying to achieve the following.
Display a list of items, this list needs to be user specific, so my first
question is How do I obtain the user Id of the person? This will run on a
intranet.
Then, based on the option selected, display 1 or more Text Boxes to capture
info. The number of boxes will vary, so Can I add controls to a web form at
run time, as I can in a windows form?
Lastly I will display some program created HTML base on the options entered.
So do I create a temporary HTML page on my server and redirect to it, or if
the HTML is in a string can I display it within a web form?

Sorry, I am a novice, but I have a urgent need, and some initial direction
would be appreciated. I am educating myself through MSDN, but if anyone
knows of more suitable training resource please say.

Regards
Tim
 
S

Steven Cheng[MSFT]

Hi Tim,


Thanks for posting in the community!
From your description, you'd like to finish the following operations:
1. Get the client user's id/username in a intranet environment
2. Dynamically add controls
3. Dynamically add a html block on a webform
Also, you are looking for some proper tutorial or guides on ASP.NET, yes?
If there is anything I misunderstood, please feel free to let me know.

As for these questions, here is my suggestions:
1. You can try use the IIS ServerVariables, it contains many clientside
machine's infos, you can get it via the "Request"
object in ASP.NET, for example:
For Each key As String In Request.ServerVariables.Keys
Response.Write(key & ": " & Request.ServerVariables.Item(key))
Next
the above code list out all the ServerVariables. For detailed info on IIS
ServerVariables you may view the follwing reference:
#IIS Server Variables
http://msdn.microsoft.com/library/en-us/iissdk/iis/servervariables.asp?frame
=true

Also, you can try using the "HttpContext.Current.User" member, which
contains the current user's identity info, if you use "Windows"
authentication in ASP.NET, you'll be able to get the clientside user's id
which routered from IIS Server to ASP.NET worker process. For more detailed
info, you may view the following reference in MSDN:
#HttpContext.User Property
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebhttpcontext
classusertopic.asp?frame=true

2. As for dynamically add sever controls on a web form, you can follow the
guides and samples in MSDN and Knowlegebase, here are the web links to some
tech article:

#Adding Controls to a Web Forms Page Programmatically
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskaddingcontrolstowebf
ormspageprogrammatically.asp?frame=true

#HOW TO: Dynamically Create Controls in ASP.NET with Visual Basic .NET
http://support.microsoft.com/?id=317515

3. There are two means to dynamically add a html block into a web page.
(1) Using the <%Response.Write( "fdsafdsfdssdf") %> block as in classic
ASP. We can still use such code block in ASP.NET. For detailed info ,please
view the following reference:

#Code Blocks in ASP.NET
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcodeblocks.asp?fra
me=true

(2). Put some certain ASP.NET ServerControls(such as Literal Control or
Label Control) and set these control's "Text" property to the certain Html
string you want to add. For example
If we have a Literal Control named "ltlHtml"(its id), then in codebehind ,
we can use such code as below to add dynamic html code block:

ltlHtml.Text = "<table width='100%' align='center'
<tr><td></td></tr></table>"

Below is the reference of Literal Web Server Control in MSDN:
#Literal Web Server Control
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconliteralwebservercont
rol.asp?frame=true

Please check out the above suggestions to see whether they help. Further
more, There're many site provide guides and many live samples on ASP.NET,
here are some:

#ASP.NET professional site:
http://www.asp.net

#GOTDOTNET ASP.NET QUICKSTART
http://samples.gotdotnet.com/quickstart/aspplus/

Hope these also helpful!


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
T

Tim Marsden

Thanks for the detailed response, I will check out the articles.

Many Thanks
Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top