
mike55
Avatar/Signature-
Posts
734 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mike55
-
Create a windows service, that calls a web method every few minutes using the http request and http response methods. I had to do this before to keep an eye on another web service and database. If I didn't get a reply, I waited for 1 minute and retried to call the web service and incremented my failed response counter from 0 to 1. If still no reply, I waited for 1 more minute and retried. If on the third attempt I got no reply, I auto-generated a SMS message and sent it to a number of support personnel. If however, I got a valid reply I used to reset my failed response counter to 0. I used to call the web service 3 times just to cover my self, the first time it failed may be down to a delay in replying/slow connection etc. and I didn't want to be sending out SMS messages and annoying people. I'll try and dig out some code for you if I get a chance. Mike55.
-
I am after reading on the microsoft site (http://www.microsoft.com/sqlserver/2008/en/us/express.aspx) that SQL Server 2008 Express is available free. Anyone know where it can be downloaded from? or if the Compact version would be more suitable. I am looking for a version that I can play with windows and web applications in my own free time. Mike55.
-
So, this method is really only effective in the case that someone gets hold of the web.config file and moves it to another machine and then tries to decrypt it? Mike55.
-
Hi all I am using the aspnet_regiis set of commands to create and a provider and encrypt/decrypt the connection string in a web.config file. The problem that I am having is that I generate the key on one machine and encrypt the config file. I then export the key and import onto my server, and assign the relevant permissions. I now want to remove the key so that nobody can look at the web.config file and be able to simply run the decryption command to see the connection string. Here are the commands that I use: 1. generate machine level rsa key Aspnet_regiis �pc �CustomKeys� �exp 2. Encrypt the connection string Aspnet_regiis �pe �connectionStrings� �app �/project name� �prov �CustomProvider� 3. Export the key Aspnet_regiis �px �CustomKeys� �C:\temp\CustomKeys.xml� �pri 4. Import the key into the server aspnet_regiis �pi �CustomKeys� �C:\temp\CustomKeys.xml� 5. Grant access to the custom key store Aspnet_regiis �pa �CustomKeys� �NT Authority\Network Service� Aspnet_regiis �pa �CustomKeys� �ASPNET� 6. Delete Rsa key container Aspnet_regiis �pz �CustomKeys� If I run the command to delete the rsa key container, the system is unable to unencrypt the connection string. What step am I missing? If I have completed all the steps correctly, how can this be secure from a user that manages to get on the server? To provide further information, I have added the following to the standard web.config file: <configuration xmlns=�http://schemas.microsoft.com/.NetConfiguration/v2.0�> <configProtectedData> <providers> <clear/> <add keyContainerName=�CustomKeys� useMachineContainer=�true� description=�Users RsaCryptoServiceProvider to encrypt and decrypt� name=�CustomProvider� type=�System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a�/> </providers> </configProtectedData> <connectionStrings> <add name=�myConn� connectionString=�your connection string��/> </connectionStrings> Mike55. Mike55.
-
Hi all Has anyone come across any good courses in either Software Quality or IT Auditing either in Ireland, UK, or USA? Michael.
-
I am using the ajax control toolkit update panel for a site. I have noted that when users use my site with the Mozilla browser and click on one of the buttons in the update panel that a double postback occurs. I have been unable to trace the source of this problem and I have been unable to replicate it in IE 6.0. Has anyone come across this problem before? I have found the source of my problems, it is caused by the following vb.net/javascript code that I am using: 'Prevent the user from double clicking on the save button. Private Sub PreventDoubleClick() Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder() sb.Append("if (typeof(Page_ClientValidate) == 'function') { ") sb.Append("if (Page_ClientValidate() == false) { return false; }} ") sb.Append("this.value = 'Please wait...';") sb.Append("this.disabled = true;") sb.Append(Page.GetPostBackEventReference(btnSave)) sb.Append(";") btnSave.Attributes.Add("onclick", sb.ToString()) End Sub I am using the above code to prevent the user from being able to double click a button. The button itself is sitting in a ajax update panel. Interesting problem. Mike55.
-
Solved the problem, by changing the order by statement to the following: ORDER BY DATEDIFF(WEEK, '2003-05-24', dbo.Timesheets.Date) DESC, Id Desc, times Mike55.
-
I have a datetime column in a table, I am performing a select statement on the table and ordering by the datetime column. Previously the order of the data was correct as all the dates were in 2007. However the last few days have seen the introduction of 2008 dates. As a result, the order of the dates as slightly off in that 2008 dates appear at the bottom of the list while 2007 dates appear at the top. Here is the query that I am using: SELECT dbo.Timesheets.Id, CONVERT(varchar, dbo.Timesheets.[Date], 103) AS [Date], dbo.Timesheets.Hours, dbo.Timesheets.Comments, dbo.Timesheets.Offsite, dbo.ParentProjects.Name as Parent, dbo.ChildProject.Name as Child, dbo.Timesheets.Hour, dbo.Timesheets.Minute, CONVERT(varchar, Hour) + ':' + CONVERT(varchar, Minute) AS times FROM dbo.Timesheets INNER JOIN dbo.StaffList ON dbo.Timesheets.Employee = dbo.StaffList.EmployeeId INNER JOIN dbo.ParentProjects ON dbo.Timesheets.Parent = dbo.ParentProjects.ProjectID INNER JOIN dbo.ChildProject ON dbo.Timesheets.Child = dbo.ChildProject.MProjectID WHERE (dbo.StaffList.Username = @Employee) ORDER BY dbo.Timesheets.[Date] DESC, Id Desc, times Mike55.
-
I have two columns in my database, one called hours, the other called minutes, both of which are of datatype int. When my users submit a time on a web page, the value is broken up and placed in the appropriate column. I am using a datagrid to display all the times, originally I was displaying the hours and minutes in two different columns. However, I now need to display them in a single column, and I want to seperate the hours and minutes by using the symbol ":". I am using: CONVERT(varchar, Hour, 110) + ':' + CONVERT(varchar, Minute, 110) AS times The code works properly, the only problem that I am having is if the minute value is less than 10, then I need to append a zero to the start. I would also like to do the same for the hours if they are less than 10. I know I could loop through the data using my .net code, but I could have thousands of records and that does not appeal to performance. Is there any way I can either set the minute and hours to have a 2 digit with both of them defaulting to "0". Mike55.
-
Hi all Maybe this community could solve a slight disagreement between two developers...We have a web app that has a functiona that allows users to download data. The function is simply using a green arrow button, pointing downwards, the image also has a tooltip which says the word download. Is this simple button sufficient for non-technical users (I don't believe so) or should we have something more obvious for the users like a hyperlink/linkbutton that says "download"/"save"? Mike55.
-
Here is my stored procedure: CREATE PROCEDURE dbo.IndividualByMonth @start datetime, @finish datetime, @staff nvarchar AS DECLARE @EIDs as int SELECT @EIDs = EmployeeId FROM StaffList WHERE Username = @staff SELECT TOP 100 PERCENT dbo.Timesheets.Id, dbo.Timesheets.Employee, dbo.Timesheets.[Date], dbo.Timesheets.Parent, dbo.Timesheets.Child, dbo.Timesheets.Hours, dbo.Timesheets.Comments, SUM(dbo.Timesheets.[Hour]) AS [hour], SUM(dbo.Timesheets.[Minute]) AS [minute] FROM dbo.Timesheets INNER JOIN dbo.StaffList ON dbo.Timesheets.Employee = dbo.StaffList.EmployeeId WHERE (dbo.Timesheets.Employee = @EIDs) AND (dbo.Timesheets.[Date] BETWEEN CONVERT(DATETIME, @start,103) AND CONVERT(DATETIME, @finish,103)) GROUP BY dbo.StaffList.Surname, dbo.StaffList.Forename, dbo.Timesheets.Id, dbo.Timesheets.Parent, dbo.Timesheets.Child, dbo.Timesheets.Hours, dbo.Timesheets.Comments, dbo.Timesheets.OffSite, dbo.Timesheets.Employee, dbo.Timesheets.[Date] ORDER BY dbo.StaffList.Surname, dbo.StaffList.Forename GO If I take the 2nd select statement, and fill in 1 for the variable @EIDs and '01/11/2007' for @start and '01/12/2007' for @finish and place it in a view I get back the rows that I am looking for. However, if I simply pass in the above two dates I cannot get back any data. Any suggestions? Mike55.
-
Hi all I am getting the above error when I go to update a database table using an sql data adapter and dataset. The steps that I follow are: 1. go to the db and use an sql stored procedure to return the data I need, all of which is being selected from the 1 table. CREATE PROCEDURE dbo.SelectAllChangeControls AS SELECT ChangeControls.Id, CONVERT(varchar, ChangeControls.Raised, 103) AS [Raised], Owners.ReverseName, Systems.Name, Status.Status, ChangeControls.CodeChange, Priority.Priority, CONVERT(varchar, ChangeControls.CompletionDate, 103) AS CompletionDate, ChangeControls.CCNumber, ChangeControls.Description, ChangeControls.Resolution, ChangeControls.CCLink, ChangeControls.EstBA, ChangeControls.EstDev FROM ChangeControls INNER JOIN Owners ON ChangeControls.Owner = Owners.Id INNER JOIN Priority ON ChangeControls.Priority = Priority.Id INNER JOIN Systems ON ChangeControls.mySystem = Systems.Id INNER JOIN Status ON ChangeControls.Id = Status.Id GO No problem so far. When the data is returned in a dataset, I place it in a session variable. 2. I then decide that I want to add a new record, so I enter the necessary data in the fields provided and click on the save button. What this does is: dim dsChangeControl as new dataset dsData = CType(Session("Times"), dataset) Private Sub AddNewRecord() 'Create a new datarow for the new record. Dim drwAdd As DataRow Dim dPrinter As New DatePrinter drwAdd = dsChangeControl.Tables("ChangeControls").NewRow 'Insert the relevant values for the columns. With drwAdd .Item("ID") = "0" .Item("Raised") = dPrinter.PrintNumericDate .Item("ReverseName") = ddOwners.SelectedItem.Text .Item("Name") = ddSystems.SelectedItem.Text .Item("Status") = "Open" .Item("CodeChange") = ddCodeChange.SelectedItem.Value .Item("Priority") = ddPriority.SelectedItem.Text .Item("CompletionDate") = "" .Item("CCNumber") = txtCCNumber.Text .Item("Description") = txtDescription.Text .Item("Resolution") = "" .Item("CCLink") = txtCCDoc.Text .Item("EstBA") = txtBa.Text .Item("EstDev") = txtDev.Text End With 'Add the row to the row's coolection of the dataset. dsChangeControl.Tables("ChangeControls").Rows.Add(drwAdd) 'Go to the database and perform the insert query. cControl.UpdateChangeControls(dsChangeControl) End Sub Once the above code has run, I have queried the rows and columns in dsChangeControl.Tables("ChangeControls") and I have confirmed that all my data is stored in the table. 3. I next send the modified dataset to my db code. (my Stored procedure) CREATE PROCEDURE dbo.InsertNewChangeControl @Raised datetime, @Owner nvarchar, @System nvarchar, @CodeChange bit, @Priority nvarchar, @CCNumber nvarchar (20), @Description nvarchar (150), @CCLink nvarchar(200), @EstBA decimal, @EstDev decimal AS DECLARE @tempOwner int DECLARE @tempSystem int DECLARE @tempPriority int SELECT @tempPriority= (Id) FROM dbo.Priority WHERE (Priority = @Priority) SELECT @tempSystem = (Id) FROM dbo.Systems WHERE (Name = @System) SELECT @tempOwner = (Id) FROM dbo.Owners WHERE (ReverseName = @Owner) INSERT INTO ChangeControls (Raised, Owner, mySystem, Status, CodeChange, Priority, CCNumber, Description, CCLink, EstBA, EstDev) VALUES ( @Raised, @tempOwner, @tempSystem, 1, @CodeChange, @tempPriority, @CCNumber, @Description, @CCLink, @EstBA, @EstDev) GO (vb.net code) Public Function UpdateChangeControls(ByVal ccData As DataSet) As Boolean Dim sqlReturn As Boolean = True Try daAdapter.InsertCommand = New SqlCommand daAdapter.InsertCommand.Connection = cnConn daAdapter.InsertCommand.CommandText = "InsertNewChangeControl" daAdapter.InsertCommand.CommandType = CommandType.StoredProcedure 'Inserting a new record to the database. daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@Raised", SqlDbType.DateTime)) daAdapter.InsertCommand.Parameters("@Raised").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@Raised").SourceColumn = "Raised" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@Owner", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@Owner").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@Owner").SourceColumn = "ReverseName" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@System", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@System").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@System").SourceColumn = "Name" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@CodeChange", SqlDbType.Bit)) daAdapter.InsertCommand.Parameters("@CodeChange").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@CodeChange").SourceColumn = "CodeChange" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@Priority", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@Priority").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@Priority").SourceColumn = "Priority" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@CCNumber", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@CCNumber").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@CCNumber").SourceColumn = "CCNumber" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@Description", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@Description").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@Description").SourceColumn = "Description" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@CCLink", SqlDbType.NVarChar)) daAdapter.InsertCommand.Parameters("@CCLink").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@CCLink").SourceColumn = "CCLink" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@EstBA", SqlDbType.Decimal)) daAdapter.InsertCommand.Parameters("@EstBA").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@EstBA").SourceColumn = "EstBA" daAdapter.InsertCommand.Parameters.Add(New SqlParameter("@EstDev", SqlDbType.Decimal)) daAdapter.InsertCommand.Parameters("@EstDev").Direction = ParameterDirection.Input daAdapter.InsertCommand.Parameters("@EstDev").SourceColumn = "EstDev" 'Perform the database update. daAdapter.Update(ccData, "ChangeControls") Return sqlReturn Catch ex As Exception sqlReturn = False End Try End Function Any suggestions? Problem is really driving me confused: and :mad:. I have used the same approach in similar projects previously with no problems. The only thing that I can think is wrong is the stored procedure. Mike55.
-
Solved the problem by trying this: ((\b[0-9]{0,2}\b)?)((\.\b[0-5]{0,1}[0-9]{0,1}\b)?) Mike55.
-
I am using a regular expression validator to try and validate that the user submits a valid time i.e. nothing over 59 minutes is allowed. I am using the following expression: (\b[0-9]{0,2}\b)?((\.\b[0-5]{0,1}[0-9]{0,1}\b)?) However, the expression is failing to catch numbers over .59 Any suggestions? Mike55.
-
I have a database field, called "hours" which has a float datatype. I am doing a query on the database table and extracting the field along with other fields into a dataset in the App_Code folder. In this dataset I have a datatable which has a column called "hours" and is a System.Decimal datatype. Now in my data entry form, I have a validation statement which ensures that users only put in valid times, i.e. anything over 59 minutes is not allowed. I am attaching the afore mentioned dataset to a crystal report which I am using to display all the data. At the end of the report I am doing a summary operation which Sums all the "hours" data together. The problem that I am having is that the sum operation is treating "hours" as a decimal number, which it is. However, I need to be able to treat it as a time. Any suggestions on how I can change the summary operation. One option suggested would be to break the time down into hours and minutes when the user first submits it, and then use a combination of multiplication, division, addition and subtraction (see: http://diamond.businessobjects.com/node/238). But that is going to get very nasty. Mike55.
-
I am using Windows authentication, with authorization set to deny users="?" I have set up three folders within my application, Admin, Staff, and All. I will have two roles, "admin" and "staff". The idea that I have is to prevent "admin" users from the Staff folder, and "staff" users from the Admin folder and that both "admin" and "staff" would have access to the All folder. My problem is that I am unable to assign a custom role to individual windows users. I have tried to use the following code: Dim userIdentity As GenericIdentity = New GenericIdentity(HttpContext.Current.User.Identity.Name) Dim roles() As String = New String() {"admin"} Dim user As New GenericPrincipal(CType(userIdentity, IIdentity), roles) However, it seems to only apply to the current page that I am on. I am not allowed to use the auto role mechanism that comes with visual studio .net as I have to use a SQL Server 2000 database. Any suggestions? Mike55.
-
Problem solved, I ended up using a float data type. Mike55.
-
I am trying to store decimal values in a SQL Server 2000 database, each decimal value can only have a max of two digits after the decimal point. In my database I have created my field, and set the precision to 7, and the scale to 2. This automatically adjusted the length of the field to 5. I am using stored procedures to insert data into the database table, I have specified that I am passing a decimal datatype of size 5. My problem is that if I insert the value 1.50, it automatically rounds it up to 2.0. Any suggestions on how to stop the rounding occuring as it seems only to occur when I am passing the value into the database through the stored procedure. Mike55.
-
Hi PlausiblyDamp Many thanks for the reply. Solved the problem, in my main web.config file I had said: "<roleManager enabled="true" cacheRolesInCookie="true"/>" Once I removed this line and changed to web.config file in each folder to: <authorization> <allow roles="admin,manager"/> <deny users="*"/> </authorization> The code worked correctly. As you als suggested, I have previously used the control/security architecture supplied by .Net 2.0 but on this occasion I am unable to apply this due to user requirements. Mike55.
-
Hi all I am trying to use role-base security with forms authentication on a web app. I have a database with a login table that has a username, employeeId, password and role. Role can be either "admin", "superAdmin" or "staff". In my proj. I have two sub-directories one is Admin and the other is All. I want to allow only the users with the "admin" and "superAdmin" role access to the Admin folder and let users with all three roles access to the All folder. Here is the web config for the Admin folder: <configuration> <appSettings/> <connectionStrings/> <system.web> <authorization> <allow roles="admin"/> <deny roles="staff"/> <deny users="?"/> </authorization> </system.web> </configuration> Here is the web config for the All folder: <configuration> <appSettings/> <connectionStrings/> <system.web> <authorization> <allow users="*"/> <deny users="?"/> </authorization> </system.web> </configuration> Here is the main section from my main web config file: <system.web> <siteMap defaultProvider="default"> <providers> <clear/> <add name="default" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/> </providers> </siteMap> <roleManager enabled="true"/> <authentication mode="Forms"> <forms name="MYWEBAPP.ASPXAUTH" loginUrl="index.aspx" protection="All" path="/"/> </authentication> </system.web> Once I get a reply back from the database indicating that the user is valid and their role (employeeRole), I use the following code to create the authentication ticket: FormsAuthentication.Initialize() Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _ txtUsername.Text, DateTime.Now, _ DateTime.Now.AddMinutes(30), True, _ employeeRole, _ FormsAuthentication.FormsCookiePath) Dim hash As String = FormsAuthentication.Encrypt(ticket) Dim cookie As New HttpCookie(FormsAuthentication.FormsCookieName, hash) If ticket.IsPersistent Then cookie.Expires = ticket.Expiration End If Response.Cookies.Add(cookie) I then redirect the user to the default start page using Response.Redirect("abc.aspx") As you will notice from the section from my main web config file, I am using a sitemap to provide my menu functionality. I have set the "SecurityTrimmingEnabled" to True. Finally, here is the entry in my 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.IsAuthenticated = True) Then If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then Dim id As FormsIdentity = CType(HttpContext.Current.User.Identity, FormsIdentity) Dim ticket As FormsAuthenticationTicket = id.Ticket Dim userData As String = ticket.UserData Dim roles() As String = userData.Split(",") HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(id, roles) End If End If End If End Sub My problem is that the role based security doesn't seem to work, in that a user with the "staff" role seems to be able to log into the admin pages. And that the site map is not working correctly i.e. displaying the correct options based on the users role. Any suggestions? Mike55
-
Could it have anything to do with localhost loopback? I am after following all the steps outlined in Steve Schofield's msg: http://weblogs.asp.net/steveschofield/archive/2007/03/17/localhost-connection-issues-list.aspx. Also found out that we are using a proxy, therefore I have selected the checkbox "Bypass proxy server for local addresses" and also I have added the localhost address in as an exception. Mike55.
-
Comes up with msg "Pinging M-ODonnell.epa.ie..." I then get the replies from 127.0.0.1... Everything looks fine. Mike55.
-
Hi all I am in the process of setting Visual Studio.net 2005 up on a new networked machine. Everything appears to have installed correctly, I have created a test application (hello world) that has a single page with the words "hello world". My problems occur when I try to run the project, as per normal the project runs from http://localhost/testapp/default.aspx. However I am getting a page cannot be displayed error. If I change the address and replace localhost with either my machine name or 127.0.0.1, the page will run correctly. Any suggestions on what I can do to solve this problem, one thing that I was considering was making a change to the virtual directory but I don't think that will work in this situation. Mike55.
-
Performing a count on an additional table.
mike55 replied to mike55's topic in Database / XML / Reporting
Thanks tfowler Your suggestion works correctly, I have had to do some modifying of the query. Mike55.