troubleshooting Question

WebForm.aspx not getting username

Avatar of yo_bee
yo_beeFlag for United States of America asked on
Web ApplicationsASP.NET
9 Comments3 Solutions378 ViewsLast Modified:
I have a simple webform that works during debugging, but once I publish to the website it is not working as expected.

The Form gets web address and appends the user name (SmithJ) to the end of the address.
This works as it is expected to during the debug process.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">



    <form id="form1" method="get" action="">
    <input type="hidden" name="groupSignOnId" value="TestLaw"/>
    <input type="hidden" name="groupSignOnPassword" value="fstessstM34iAw"/>
    <input type="hidden" name="groupUserKey" id="groupUserKey" runat="server"/>
    <input type="submit" value="Register your WSJ Subscription"/>

1.	Enter First & Last Name <br />
2.	Enter your Firm E-mail address & confirm it<br />
3.	Create a unique password for yourself <br />
4.	Select your Job Title<br />
5.	Check the Subscriber Agreement<br /> 
6.	Press Create Account<br />
    <br />
&nbsp;&nbsp;&nbsp; This is an exampe:<br />
<asp:Image ID="img1" runat="server" ImageUrl=".\images\img1.png" Height="576px" 
        Width="333px" />
    <br />
    <br />
7.	Once you press Create Account you will be brought to another page that shows you that you successfully registered for the firm subscription to WSJ<br />
8.	Press OK and you will be brought to WSJ Online site 
    <a href=""></a><br />
    <br />
<asp:Image ID="Image1" runat="server" ImageUrl=".\images\img2.png" Height="164px" 
        Width="278px" /><br />     
       <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>



Here is the VB code snippet:
Imports System.Web

Public Class WebForm1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        groupUserKey.Value = Environment.UserName()
        Label1.Text = Environment.UserName()
    End Sub

End Class

For testing purposes I added ASP:LABEL to display what the value is.
When it run it from the IIS server it just displays the APPLICATION POOL assigned to the app.

If there is a better way for me to accomplish getting the user name to the id="groupUserKey" value then I am completely open to the change.

Utkarsh Kulkarni
Sr. Sw Eng

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros