背景: Web サービスで提供される情報に基づいてデータベースにユーザーを登録し、ランダムなパスワードとユーザー名を自動生成し、マーケティング会社に基づいてアプリケーションを取得するためのリンクをユーザーに電子メールで送信する webForm アプリがあります。選択されました。
質問:
- 現在ログインしているユーザー名を MarketerName_TextBox フィールドに入力するにはどうすればよいですか (それは User.Identity.Name で、その行を aspx.vb の末尾または aspx の末尾に追加しますか?)
フロントエンドのスクリーンショットは次のとおりです。
私はWrox の Windows Authentication Tutorial のコードから離れてきましたが、私がやろうとしていることには十分ではありません。
web.config ファイル:
web.config ファイル (関連するコードのみ表示):
<authentication mode="Windows"/>
<authorization>
<allow users="alg\bmccarthy, alg\phoward" />
<allow roles="alg\ACOMP_user_Admin" />
<allow roles="alg\ACOMP_user_AMG" />
<allow roles="alg\ACOMP_user_BIG" />
<allow roles="alg\ACOMP_user_NIS" />
<allow roles="alg\ACOMP_user_GLA" />
<allow roles="alg\ACOMP_user_PIP" />
<allow roles="alg\ACOMP_user_PSM" />
<allow roles="alg\ACOMP_user_PAM" />
<allow roles="alg\ACOMP_user_ANN" />
<allow roles="alg\ACOMP_user_AAM" />
<allow roles="alg\ACOMP_user_MWM" />
<allow roles="alg\ACOMP_user_GIM" />
<deny users="*" />
</authorization>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAcompService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://172.17.1.40/aCompService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IAcompService" contract="aComp_ServiceReference.IAcompService"
name="BasicHttpBinding_IAcompService" />
</client>
</system.serviceModel>
txtMarketerName_TextChanged() および Page_Load() メソッドを使用した default.aspx.vb コード:
Private Sub GetCarriers()
Dim ac1 As Array
ac1 = proxy.GetCarrierNames("test", "test")
For Each item In ac1
lbCarriers.Items.Add(String.Format("{0} | {1} | {2}", item.CarrierID, item.CarrierNameLong, item.CarrierNameShort))
Next
End Sub
Private Sub txtMarketerName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMarketerName.TextChanged
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load, Me.Load, Me.Load
If Not lbCarriers.Items.Count > 0 Then
GetCarriers()
GetMarketingCompanies()
End If
End Sub
マーケティング担当者名のテキスト ボックス フィールドが表示される default.aspx コード:
<table id="Table1" border="0" cellpadding="6" cellspacing="0" align=center>
<tr>
<td class="style1">
My Name (auto-populated Current Logged In User's Name): </td>
<td bgcolor="#ffffff" class="style6">
<asp:TextBox ID="txtMarketerName" runat="server" Width="250px">
</asp:TextBox>
</td>
<td bgcolor="#ffffff" class="style2">
<asp:RequiredFieldValidator ID="regValMarketerName" runat="server"
ControlToValidate="txtMarketerName" ErrorMessage="Marketer Name is required" Text="*"
ValidationGroup="Valtxt">
</asp:RequiredFieldValidator>
</td>
</tr>
ご覧いただきありがとうございます。
役立つリンクや提案があれば、賛成票を投じます!