Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

David Flores

@David Flores
About
Posts
57
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Looking for some code that imports a CSV file using ADO.NET
    D David Flores

    I think the title says it all...oh except in VB.NET Thanks in advance David

    Database csharp

  • SQL Permissions keep reseting (web)
    D David Flores

    Well I figured it out, the answer is to write a procedure that goes off to set the permissions. Just have this code run by the SQL agent

    use tempdb
    Declare @userName char(100)
    Declare @DatabaseUserID [smallint]

    --internal sql user name or domain\username
    Set @userName = 'InternalUser'
    select @DatabaseUserID = [sysusers].[uid] from sysusers where name = @userName
    IF @DatabaseUserID IS NULL
    BEGIN
    EXEC sp_grantdbaccess @userName
    EXEC [sp_addrolemember]
    @rolename = 'db_datareader',
    @membername = @userName
    EXEC [sp_addrolemember]
    @rolename = 'db_datawriter',
    @membername = @userName
    END

    Database database sql-server sysadmin tools question

  • SQL State Server, permissions keep resting
    D David Flores

    I am using SQL server to handle my session variables. However every time I reboot the server the permission to call the SELECT queries get reset and I have to manual set them again. To create the SQL Session server I used the script InstallSqlState.sql, should I have used InstallPersistSqlState.sql? Thanks.

    ASP.NET database sql-server sysadmin tools question

  • SQL Permissions keep reseting (web)
    D David Flores

    I am using SQL server to handle my session variables. However every time I reboot the server the permission to call the SELECT queries get reset and I have to manual set them again. To create the SQL Session server I used the script InstallSqlState.sql, should I have used InstallPersistSqlState.sql? Thanks,

    Database database sql-server sysadmin tools question

  • custom validator problem
    D David Flores

    It is not a bug. Custom validators when assigned to a text box only go off when there is text in the control. What you want to do is make sure that the ControlToValidate is NOT set. I use custom validators to validate many different controls at once. Also make sure the the button has the CausesValidation property set to true. If you are still having some problems, I can send you my validation code.

    ASP.NET help question

  • Problems with FormsAuthenticationTicket in role-base security
    D David Flores

    The problem was using FormsAuthentication.RedirectFromLoginPage, it writes its own cookie which over writes yours!!!:mad: So I change it to a Response.Redirect and everything works fine. :-D
    However...It took me two days to figure that out because it is not in the documentation. ugh!
    Later

    ASP.NET question security debugging

  • Problems with FormsAuthenticationTicket in role-base security
    D David Flores

    I am having problems with the FormsAuthenticationTicket keeping the UserData that I store in it when creating the ticket. The UserData (i.e. my role information) is getting lost. My login code is the following (simpiflied)

    'returns "SA" for this demo
    Dim roles As String = GetRoles()
    Dim authTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, Me.txtLogin.Text, DateTime.Now, DateTime.Now.AddMinutes(60), False, roles)
    Dim encryptedTicket As String = FormsAuthentication.Encrypt(authTicket)
    Dim authCookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
    Response.Cookies.Add(authCookie)
    FormsAuthentication.RedirectFromLoginPage(Me.txtLogin.Text, False)

    Now when a page gets authenticated the code, Application_AuthenticateRequest, in the global.asax the following happens (again simplified)

    Dim cookieName As String = FormsAuthentication.FormsCookieName
    Dim authCookie As HttpCookie = Context.Request.Cookies(cookieName)
    Dim authTicket As FormsAuthenticationTicket = Nothing
    authTicket = FormsAuthentication.Decrypt(authCookie.Value)

    'this should be "SA" but UserData is ""
    Dim roles As String() = authTicket.UserData.Split("|".ToCharArray)

    Dim id As FormsIdentity = New FormsIdentity(authTicket)
    Dim principal As CustomPrincipal = New CustomPrincipal(id, roles)
    Context.User = principal

    If I stop the execution in the debugger and modify the value of roles to be "SA" then everything else works fine. The big question is, Why is UserData empty? Thanks in advance.

    ASP.NET question security debugging

  • Help with DateTimePicker
    D David Flores

    Is that the source from your aspx file? or the source from right-clicking in the browser and selecting "view source"? It doesn't looking like line 11 is the real problem. Run the program again, do a view source from the browser and see what line 11 is there. Also, you could a put a break point in and traverse line by line to see where it blows up. Hope that helps

    ASP.NET help csharp data-structures debugging tutorial

  • Help with DateTimePicker
    D David Flores

    It sounds like you are trying to use an object before creating. For example you have something like this

    Dim x As Object
    x.SomeFunction 'produces error

    You should have something like this

    Dim x As New Object
    x.SomeFunction

    or

    Dim x As Object
    x = New Object
    x.SomeFunction

    Hope this helps.

    ASP.NET help csharp data-structures debugging tutorial

  • Web Anaylsis Tools?
    D David Flores

    Thanks, but I already know how to search for free web analysis tools. I am asking for peoples opinions on any ones that they already have used or heard about. I am looking for personal recommendations.

    Web Development tools question

  • DataSet and Session variables
    D David Flores

    Most of the examples in the O'reilly books are just to show a working concept, which doesn't really fit into the real world situtation. You should not store the dataset in the session variable for many reasons, the biggest reason is data integratity. If some other process, person, service changes the database, the information stored in the session variable will be invalid which can lead to many problems. Just keep getting your data from the database, just be smart with your queries if performance is becoming an issue, e.g. dont just blinding call "SELECT * FROM Table" when you only need 1 column of data. Anyway, thats just my opinion.

    ASP.NET database tutorial question discussion learning

  • from DateTime to Int
    D David Flores

    I think he wants to remove the "/" also. so do this... DateTime.Now.ToLongTimeString().Replace("/", "")

    ASP.NET tutorial

  • Web Anaylsis Tools?
    D David Flores

    Anyone have a suggestion for a good FREE web anaylsis tool?

    Web Development tools question

  • Set Focus
    D David Flores

    There are lots of different ways to do it, but here is a function that you can use for setting the focus on loading of page.

    '"name" is the control's ID
    Private Sub FocusOnControl(ByVal name As String)
        Dim strBuilder As String = ""
        strBuilder += "<script language='javascript'>"
        strBuilder += "document.getElementById('" + name + "').focus();"
        strBuilder += "</script>"
        RegisterStartupScript("FocusOnControl", strBuilder)
    End Sub
    

    Then in say in your Page_Load you can call the function

    Private Sub Page\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FocusOnControl("txtBox")
    End Sub
    
    ASP.NET question csharp html asp-net

  • Session_End doesnt work!!
    D David Flores

    I know Session_End event doesnt get trigger if you have an out-proc session state, i.e. SessionState or SQLServer. So how can I have the session server or the web application trigger an event (i.e. some asp code) when the session times out?

    ASP.NET question database sysadmin

  • How to create an webform without toolbar....
    D David Flores

    Its not the webform that displays the toolbar, its how you open the webform in the browser. Take a look at the jscript for the open function of the window object. basically you will do some like the following:

    <script LANGUAGE="JavaScript">
    var url = "mypage.aspx"; // your url to the webform
    var name = "popup"; // any name for the window, if you want to reuse the window
    var settings = "menubar=no,status=no,resizeable=no,toolbar=no,scrollbars=no"

    window.open(url, name, settings);
    

    </script>

    Hope this helps.

    ASP.NET csharp asp-net tutorial

  • ASP.NET Performace
    D David Flores
    1. Server.Transfer works as a kind of server-side redirect. It terminates the execution of the current page and passes control to the specified page. Unlike Server.Execute, control is not passed back to the caller page. It is more effective than Response.Redirect. However, If you use Server.Transfer to transfer a user to another page, ensure that the currently authenticated user is authorized to access the target page. If you use Server.Transfer to a page that the user is not authorized to view, the page is still processed. Server.Transfer uses a different module to process the page rather than making another request from the server, which would force authorization. Do not use Server.Transfer if security is a concern on the target web page. Use HttpResponse.Redirect instead. p.s. That is the information i read from "Programming Microsoft ASP.NET" and "Improving Web Application Security: Threats and Countermeasures" 2) I never call Dispose...I like ASP decide when to do clean up.
    ASP.NET csharp asp-net sysadmin performance question

  • Response.Redirect and locating to specific area on page
    D David Flores

    Well you could pass the information in a session variable. When the page loads, check the variable, if variable exists then display the apprpoiate information. Just a thought.

    ASP.NET database help question learning

  • Form-Based Login Help
    D David Flores

    How do you get the SessionCookie value to add it the [Users] table? Also should there also be another query, something like INSERT INTO [Users] (SessionCookie) VALUES (xxx) WHERE [Users].[Name]=yyy ? Thanks for all your help

    ASP.NET csharp asp-net help question

  • Form-Based Login Help
    D David Flores

    Ah I figured it out...atleast with setting up my sessionState to SQLServer mode. I will get back if I need any more help.

    ASP.NET csharp asp-net help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups