Basic Chat Using ASP .NET AJAX

Sign in to queue

The Discussion

  • User profile image
    Randy

    How would you recommend handling that a user can't scroll up? This is due to the message list is updating every second. The javascript jumps to the bottom every second.

  • User profile image
    Clint

    @Randy I would add in some javascript to check if a user scrolled up.  If they did then don't jump down

  • User profile image
    Clint

    @Alton @jeksya working on getting the source and will move it to our server instead

  • User profile image
    Clint

    @Alton @jeksya Personify Design gave me the source code and links have been updated.  Should work now.

  • User profile image
    pwn

    hi, very nice example to get up and going, but it would be nice if you also updated the web.config

    I copied the web.config from a default asp.net 3.5 project and the whole thing compiled fine after that.

  • User profile image
    Dave Violette

    "@Randy I would add in some javascript to check if a user scrolled up.  If they did then don't jump down"

    Can someone help me with the code for this? I am not javascript expert.

    Also, any help in getting rid of flickering?

  • User profile image
    rahul

    i am not able to download this link

  • User profile image
    Clint

    @rahul Link at the top of the page labeld "Download" worked for me.

  • User profile image
    mickey

    Can your chatters be added live or do they need to be preloaded as above in the global asax

  • User profile image
    lost

    I am a total noob on what to do after downloading the zip file. I hope someone can guide me how to test it. I tried opening the project in visual basic 2008 but there is no project file from the sample. I really have no idea what to do next. Smiley

  • User profile image
    Clint

    @lost, Looks like you'll have to create a new project to run this.  sadly, looks like this example doesn't have a project file.

    I would follow the article and copy the code out of the files to recreate it.

  • User profile image
    Marvin d Martian

    has anyone tried extending the code to add login functions? Ive tried but the messages from other chatters won't show up.

  • User profile image
    Monoko

    Hey I'm using this basic code for a chat that I'm about to create but I cant figure out how and where to add a function that adds the users dynamically? Can anyone help me?

  • User profile image
    FishGuy

    I am getting error at the chat.vb and chatter.vb saying the 'Type Chatter is not defined'

    Please can you help me in solving this problem?

    I have the same issue!

  • User profile image
    Weggo

    I deleted/exclude from project the web.config file and start debugging. This created the a new web.config file and fixed all the problems I had.

    Peace..

  • User profile image
    Clint

    @pallavi what type of problem?

  • User profile image
    pallavi

    i am getting prob with chatter in glogal.asax.plz help me

  • User profile image
    Sudheer

    Hi,

    The Code is working fine but how can this be activate for instant messaging between two users.

    Also how to pop up the message on the other users page,when i send him a message.

  • User profile image
    beatrice

    so could you help us on how to use the chat with logged in and logged out users in a session please? but only two people chatting to make it simple.....

  • User profile image
    obastemur

    Thanks for article and check PokeIn.codeplex.com for great ajax library with chat samples.

  • User profile image
    Heeren

    your code works gr8. but, what if user wants to scroll up to see previous conversation?

  • User profile image
    Clint

    @davdav if you download the source code which is a link at the top of the article, you'll see the classes for those objects

  • User profile image
    davdav

    chatter and chat is not defined..T_T

  • User profile image
    Bad BOy

    Is it just me, or is it now not working on final build of ASP.NET 2.0 Ajax Extensions 1.0?!

    Microsoft.Web.Extensions.dll missing?!@

    web config erro..How to Solve..

  • User profile image
    raj

    thanks

  • User profile image
    Ravindar Kumar Gupta,​9650969114

    Thnaks for help

  • User profile image
    Sara

    i had tried these but its showing some error, missing assembly or namespace for chat and chatter.

  • User profile image
    ritu

    iikkkjjjjj

  • User profile image
    chhavi

    helllloooooo

  • User profile image
    fdffd

    @Randy:

  • User profile image
    Kyle

    Love the simplicity of the project, can you give me some tips on how to implement more than one chat room?

  • User profile image
    vivek

    scroll bar is restrict to the bottom of DIV.
    how can we change the code so that scroll bar can go up while we scroll the scrollbar using mouse..?

  • User profile image
    abhinav bagora

    chatter and chat is not defined..
    how can i solve this problem?

  • User profile image
    Hsikao

    Hi, really interested your Basic chat.
    I want to add new chatter.
    I simpelly add a textbox and a button, how can I added this new user into the chatter list.
    My code below make list become double.
    And after added new user I want this new user become current active user. How to do it Please?

    Protected Sub btnJoin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim chatters As List(Of Chatter) = New List(Of Chatter)
    chatters = CType(Application("Chatters"), List(Of Chatter))

    Dim id As Guid = Guid.NewGuid
    chatters.Add(New Chatter(id, txtNewUser.Text))

    m_chatter = Chatter.ActiveChatters(New Guid(id.ToString))

    For Each c As KeyValuePair(Of Guid, Chatter) In Chatter.ActiveChatters
    c.Value.Join(Chat.ActiveChats(0))
    Next
    End Sub

  • User profile image
    hassan

    But what if we can develop a chat that does not depend on session at all ? can I found one like that ?

    http://www.uobabylon.edu.iq

  • User profile image
    sepehr

    thanks

  • User profile image
    John

    There's nothing worse than a tutorial with code that doesn't work.

  • User profile image
    Harish B K

    I just want to know hot to get Public Key Token which has mentioned in web.config file

    ex:
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
    <add name="ScriptModule" preCondition="integratedMode" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </modules>
    <handlers>
    <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler"/>
    </handlers>
    </system.webServer>

  • User profile image
    anurag

    hi

  • User profile image
    Ashwani

    hello

  • User profile image
    Mark

    I've implemented a version of this on my own website. I use windows forms authentication, and set the page authentication to logged in users. However, Ithough users can log in and join the chat page, we all get redirected to the login page after just a few messages get posted.

    Is there something I should know about Ajax and forms authentication. I think the problem is because a partial post back fails authentication.

    I am developing the site for a hosted service so I can't debug live.

    Any suggestions?

  • User profile image
    Monestar

    Hi!

    Thanks

  • User profile image
    Abdo

    Hey this is really great but can you do an one with socket programming ?
    please reply asap

  • User profile image
    sri

    I'm getting error msg as index out of range at Chat.ActiveChats()[0].Any help to fix this issue?

  • User profile image
    suhas dakhare

    Please Help in developing the simple chat application in asp.net...with C#.net

  • User profile image
    Anonymous

    I just want to thank you for that snippet of javascript that scrolls to the bottom of a window. I tried EVERY example given to do this on the web, and none of them worked.

    My no-frills web chat now works, is 35 lines of code in vb plus 2 update panels, 2 text boxes, and a button on the form. Easy peasy!

Add Your 2 Cents