Application and HTTP server communication [newbie]

I would like to create an automatic updater for my application. I wish to adopt WWW server to accomplished it. Here is my scenario:

1. Application opens an URL  for example

 checkupdates.com/check.aspx id=ppp&pwd=ppp

Here is check.aspx.cs which simply checks id and pwd correctness and responds with file that contains update info:

            string id = Request.Params["id"];
            string pwd = Request.Params["pwd"];
            string app = Request.Params["app"];

            if (id == "ppp" && pwd == "ppp")
            {
                Response.ContentType = "plain/text";
                Response.AppendHeader("Content-Disposition","inline; filename=NameAsYouWantItToAppearToUser.csv");
                Response.Write(new char[] { 'A', 'B', 'C', 'D' }, 0, 4);
                Response.End();
            }

Now i got problems with app side of my scenario. I can simply request to open that URL but i have no idea how to make respond. I have two possibilities. First one is when file with info should be downloaded and second one when id or pwd is incorrect. Any suggestions I believe that should be very simple to do but... i stuck...

TIA, M


Answer this question

Application and HTTP server communication [newbie]

  • laboremus

    Hi,

    It seems that you want to dev an asp.net website who have the role authentication. That is convenience for you to use asp.net authentication system. And if the user is valid, he can enter the log in the website and do some stuff, otherwise if invalid, he can be reject to enter the webpage, and so he can not do things in the website.

    BTW, ASP.NET related questions should be asked on http://forums.asp.net/



  • Kevin Dente

    Figo Fei - MSFT wrote:

    Hi,

    First, use queryString to transfer password is somewhat dangous, try to use session instead.

    And what do you mean "respond" The user entered the website and if he is valid, what will you do, and if invalid Can you give more description



    I believe that HTTPS should solve password transfer problem. I assume that .NET contains support for HTTPS protocol. Moreover i believe that sending only user's id should be sufficient and password in my case is unnecessary.

    "Respond" for me is:
    As i said before i would like to open URL with updater. I open that URL and pass id and password. After that i have to perform check if server wants to send me a file that conatins update information or not. That's the problem for me, i have no idea how can i perform that check. I have to implement proper reaction in my client side aplication in two cases. If server starts to send me a file i have to make scenario A and if not, i have to display message that user is not authorized to perform updates. Hope i clearly explain what i'm trying to accomplish.
    BTW, All this updater-stuff is very easy to implement via windows sockets but i don't want to use solutions that i already know and i wish to touch something new.

    TIA,
    M

  • JavaBoy

    In first version of my updater I wrote all stuff using .NET remoting. But I encounter some problems (could not set connection timeout and when my service was down, i had have to wait 60 secs or so to get connection error. I spent a week digging in whole net to try to find solution and i gave up). Now, i'm affraid that web services can create similar problems. Moreover performing all stuff via HTTP protocol is more flexible and my updater will be able to work in different environments.

  • lagu2653

    Hi,

    First, use queryString to transfer password is somewhat dangous, try to use session instead.

    And what do you mean "respond" The user entered the website and if he is valid, what will you do, and if invalid Can you give more description



  • Annihil8

    perhaps instead of using a web page you could consider creating a web service. i.e. create a web service, and then, in the calling application, create a web reference to the service. that way, VS will automatically go about the business of creating the web service proxy and you'll be able to call the methods in the web service as though the were local to the application.

  • Lance Colton

    Hi,

    It seems that my assumption that problem lies on application side was missed. Now i know what and where i should look for. Thanks for showing me right direction.

  • Application and HTTP server communication [newbie]