Jump to content
Xtreme .Net Talk

wsyeager

Avatar/Signature
  • Posts

    140
  • Joined

  • Last visited

Everything posted by wsyeager

  1. forms authentication question... Derek, how would I know what the role of the user is if it is not placed anywhere to begin with? I get the role from the db and want to place it in a cookie so I can read it..... The thing is, how do I read that cookie to get that role information? That's what I don't know how to do......
  2. Everything is working in my authentication process except for the fact that I can't retrieve the "UserData" property from the "FormsAuthenticationTicket". Write before I do a "RedirectFromLoginPage", I check the "UserData" property of the "FormsAuthenticationTicket". It's set to the value "Admin" (a role for the user) which is what I want. Here is the code: strUserName = CType(drOLEDBNicemScheduling.GetValue(1) & Chr(32) & drOLEDBNicemScheduling.GetValue(2), String) 'Set the authentication ticket Dim arrRoles(0) As String arrRoles(0) = drOLEDBNicemScheduling.GetValue(3) Dim ticket As New FormsAuthenticationTicket(1, strUserName, Now, DateAdd(DateInterval.Minute, 60, Now), ValidateLogin.PersistantCookie, arrRoles(0)) Dim cookie = New HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)) If ValidateLogin.PersistantCookie Then Response.Cookies.Add(cookie) End If 'Create Identity Dim objIdentity As New Security.Principal.GenericIdentity(strUserName) Dim objPrincipal As New Security.Principal.GenericPrincipal(objIdentity, arrRoles) FormsAuthentication.RedirectFromLoginPage(strUserName, ValidateLogin.PersistantCookie) However, once I get in the Global.asax file in the "Application_AuthenticateRequest" event (fired by the FormsAuthentication.RedirectFromLoginPage method), I check the "UserData" property of the ticket and it's an empty string! All the other properties pertaining to the ticket are there. I'm setting up the cookie, so the "Userdata" property should be populated. Here is the code in the global.asax file: Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs) If (Not (HttpContext.Current.User Is Nothing)) Then If HttpContext.Current.User.Identity.AuthenticationType = "Forms" Then If HttpContext.Current.User.Identity.IsAuthenticated Then Dim id As FormsIdentity = HttpContext.Current.User.Identity Dim ticket As FormsAuthenticationTicket = id.Ticket Dim roles(0) As String roles(0) = ticket.UserData HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(id, roles) End If End If End If End Sub What am I doing wrong??? I need to be able to identify the role of the user (they will only have 1 role).
  3. During execution of a multi-tiered website, I get the following error that .Net can't load the following DLL (nOTICE THE DataAccessLayer.DLL) Parser Error Message: Access is denied: 'DataAccessLayer'. Source Error: Line 196: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> Line 198: <add assembly="*"/> Line 199: </assemblies> Line 200: </compilation> Source File: c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 198 Assembly Load Trace: The following information can be helpful to determine why the assembly 'DataAccessLayer' could not be loaded. === Pre-bind state information === LOG: DisplayName = DataAccessLayer (Partial) LOG: Appbase = file:///c:/inetpub/wwwroot/Nicem_Scheduling LOG: Initial PrivatePath = bin Calling assembly : (Unknown). === LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: DataAccessLayer LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nicem_scheduling/4f9aa495/7b31bb07/DataAccessLayer.DLL. LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nicem_scheduling/4f9aa495/7b31bb07/DataAccessLayer/DataAccessLayer.DLL. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/Nicem_Scheduling/bin/DataAccessLayer.DLL. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: DataAccessLayer, Version=1.0.1298.25886, Culture=neutral, PublicKeyToken=null Once I place the new version of this dll in the following directory "c:/inetpub/wwwroot/Nicem_Scheduling/bin", it works fine. On subsequent executions of the same web page, I get the above error even though I havn't changed any settings or code on any of my 3 tiers. I checked to make sure that the ASPNET user has Admin rights, which it does. How can I resolve this situation?
  4. I need to have a datagrid with exactly 96 rows (preferably at design time). These rows represent a possible 1/4 hour shift for an entire 24 hr period. The grid will consist of 4 columns set up at design time. These columns will be templated columns. The first column will display the hard-coded shift time for each row, and the subsequent columns will display listboxes tied to a datasource. I tried searching the net a little bit for such a scenario, but could not come up with anything. Can some supply me a link where this scenario is played out (meaning adding rows to a datgrid at design or run time and supplying listboxes from within a datagrid). btw, which control should I use for this scenario? Datagrid, Datalist or Repeater?
  5. Thanks a lot! I was able to successully import the namespace...:D
  6. I'm using VS.Net 2003 with the 1.1 dot net framework... I'm trying to use the imports statement: Imports system.web.mail However, no further node comes up after "system.web"......... I was able to use this namespace without a problem in the 1.0 framework with vs 2002. How come I can't see the namespace? I need to send mail from within my asp.net pages.........
  7. I just used the following code in my child form to accomplish this task: Dim frmParentForm As frmMain frmParentForm = Me.MdiParent frmParentForm.mnuAdHocExtOrdStatDlyRptPend.Enabled = True
  8. Is there any way to enable a menu item that exists on an MDI form from within a child form? My MDI menu item is declared as follows: Friend WithEvents mnuAdHocExtOrdStatDlyRptPend As System.Windows.Forms.MainMenu Me.mnuAdHocExtOrdStatDlyRptPend = New System.Windows.Forms.MainMenu() Here is the code to initiate my child form: Private Sub OrdStatDlyRptPend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAdHocExtOrdStatDlyRptPend.Click DisableMenus() Dim frmObject As New frmOrdStatDlyRptPend() frmObject.MdiParent = Me StatusBar1.Panels(0).Text = "Loading Customers and ReportIDs..." frmObject.Show() StatusBar1.Panels(0).Text = "Processing Ad-hoc Daily Report Pending Order Status functionality..." End Sub Now that I'm in the child form, I was under the assumption that since the menu item (mnuAdHocExtOrdStatDlyRptPend) is declared as a "Friend", it should be available to all the methods from within the assembly.... However, when I try and use the following in the child form: "mnuAdHocExtOrdStatDlyRptPend." and use the dot for the intellisense, nothing pops up. How can I disable this MDI menu option from within my child form?
  9. This method is simply a middle-tier method. I developed an entire backend class that takes care of all data-access and data-updates. I have been using these methods for the past year os so with no problem.......
  10. I am using an OLEDB provider, and can't get the CommandTimeout property to work! I want the query to fire a CommandTimeOut exception if it is taking too long to run. Here is my code: Public Function RunAdHocQuery(ByVal strDataSource As String, ByVal strQuery As String) As DataSet Dim cnRpt As New OleDbConnection("Provider=MSDAORA.1;Password=ten;Persist Security Info=False;Password=ten;User ID=CVRSS;Data Source=" & strDataSource & ".FPL.COM") 'Dim cnRpt As New OleDbConnection("Provider=OraOLEDB.Oracle.1;Password=ten;Persist Security Info=True;Password=ten;User ID=CVRSS;Data Source=" & strDataSource & ".FPL.COM") Dim cmdRpt As New OleDbCommand(strQuery, cnRpt) Dim daRpt As New OleDbDataAdapter(cmdRpt) Dim ds As New DataSet() Dim objDataAccess As New DataAccess() Try cmdRpt.CommandTimeout = 5 daRpt.SelectCommand = cmdRpt ds = objDataAccess.GetOLEData(cnRpt, daRpt, cmdRpt, ds) Catch exexception As TimeoutException Throw (exException) Catch exException As InvalidOperationException Throw (exException) Catch exException As ArgumentNullException Throw (exException) Catch exexception As NotSupportedException Throw (exException) Catch exException As OleDbException Throw (exException) Catch exException As Exception Throw (exException) Finally If cnRpt.State = ConnectionState.Open Then cnRpt.Close() End If objDataAccess = Nothing cmdRpt.Dispose() daRpt.Dispose() cnRpt.Dispose() End Try Return ds End Function Is there any way that I can get the CommandTimeOut property to work???:mad:
  11. I got it to work by just assigning "Me" to the frmObject.MDIParent instead of "Me.Parent" since I'm currently insdide the main MDI parent form to begin with...
  12. I have child forms that act as a UI to the user (from within the MDI app), runs some process, then displays another separate child form to the user (from within the parent MDI main form) displaying the results of a Crystal Report using the following code: Dim frmObject As New frmAdHocISPProvisioningReport(DsProvOrderSum1) frmObject.MdiParent = Me.MdiParent frmObject.Show() When using the same code above, and trying to run a similiar report directly from the main form itself (instead of another child form acting as a UI), the report comes up outside of the main parent form not as its child. Why????????
  13. When data is retrieved from my database and placed in a listbox, the first item is always selected. However, I do not want that behavior. How do you programatically unselect items in a listbox? I know how to do it using a webform listbox, but the windowsform listbox does not work the same way.
  14. I am able to successfully execute a thread. However, I notice that when the thread is executing, the hourglass is off (which is expected), but I can't seem to select any other menu items in my MDI application while the thread is executing. I can do other stuff with Windows outside of my application, but not from within my MDI app. Why??? I have another process in my MDI app that uses threading (where I don't need to create a delegate and I can access other menu items in my MDI app while the thread is executing). Here is my code in regards to the first item I talked about above where I had to create a delegate (1st paragraph): Private thdPendingRpts As Thread . . . Private Sub btnRpt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRpt.Click Try thdPendingRpts = New Thread(New ThreadStart(AddressOf ThreadProc)) thdPendingRpts.IsBackground = True thdPendingRpts.Priority = ThreadPriority.AboveNormal thdPendingRpts.Name = "Pending Reports" thdPendingRpts.Start() StatusBar1.Text = "Thread 'Pending Reports' has started" Catch exException As ThreadInterruptedException StatusBar1.Text = exException.Message Catch exException As ThreadStateException StatusBar1.Text = exException.Message Catch exException As ThreadAbortException StatusBar1.Text = exException.Message Catch exException As System.Exception StatusBar1.Text = exException.Message End Try End Sub Private Sub ThreadProc() Try Dim mi As New MethodInvoker(AddressOf ProcessData) Me.Invoke(mi) Catch exException As ThreadInterruptedException StatusBar1.Text = exException.Message Catch exException As ThreadStateException StatusBar1.Text = exException.Message Catch exException As ThreadAbortException StatusBar1.Text = exException.Message Catch exException As System.Exception StatusBar1.Text = exException.Message End Try End Sub Private Sub ProcessData() btnRpt.Enabled = False StatusBar1.Text = "Retrieving SQL1 data..." DsOrdStatDlyRptPend1.Clear() BuildSQL1() If Not blnError Then For i = 0 To DsOrdStatDlyRptPend1.OrdStatDlyRptPendSQL1.Rows.Count - 1 StatusBar1.Text = "Retrieving SQL2 data..." BuildSQL2() Next If Not blnError Then For i = 0 To DsOrdStatDlyRptPend1.OrdStatDlyRptPendSQL1.Rows.Count - 1 StatusBar1.Text = "Retrieving SQL3 data..." BuildSQL3() Next If Not blnError Then For i = 0 To DsOrdStatDlyRptPend1.OrdStatDlyRptPendSQL1.Rows.Count - 1 StatusBar1.Text = "Retrieving SQL4 data..." BuildSQL4() Next If Not blnError Then StatusBar1.Text = "Generating report..." BuildReport() End If End If End If End If StatusBar1.Text = "Thread 'Pending Reports' has finished" btnRpt.Enabled = True thdPendingRpts = Nothing End Sub Does any body know why I can't select any other items from within my application while this thread is executing???
  15. I'm getting the following error when trying to set a datasource property to a listbox: "Item collection can't be modified if the Datasource property is set". I want to add a default item to the listbox after the data is loaded, but I get the above msg: Here is my code: cboCustomerID.DataSource = DsCustomerID1.tblCustomerID cboCustomerID.ValueMember = DsCustomerID1.tblCustomerID.Columns("CUSTOMER_ID").ToString cboCustomerID.DisplayMember = DsCustomerID1.tblCustomerID.Columns("CUSTOMER_ID").ToString cboCustomerID.Items.Insert(0, "ALL") Does anyone know how I can add a default item to the listbox?
×
×
  • Create New...