Help to design this requirement

Hello All,

 I have to design a counter.aspx page which will taken any number of counter names. Only one counter name can be supplied each counter.aspx request. As a response I need to show a single pixel image. Each counter name and their hits are tracked in DB periodically.

Additional I also need to have a provision of how many hits each name received today and yesterday and so on.

Thanks


ssanghavi82Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel WilsonCommented:
Is this homework?

Even so ... I can give a few hints ...

Start w/ your DB design.  That's the core of this project.

Not sure on the next one ... but I think Server.Transfer may be a slick way of returning your little image when the page is requested.  You can dynamically generate an image ... but that's probably more work than you need to do.
0
ssanghavi82Author Commented:
Yes this is a home work. I have already created my DB. Its 1 table with id,datecreated, time, countername, counterhits.

I have also created a image.

On the counter.aspx file what shd i do .... can u give me some hints
0
Daniel WilsonCommented:
The key thing your counter.aspx file will do is execute a SQL statement.  Could be a stored procedure ... but the statement will look something like:

If exists (Select 1 from MyTable where convert(varchar(10), getdate(), 102 ) = convert(varchar(10), DateCreated, 102 ) and CounterName = @counterName)  Update MyTable set counterHits = counterHits+1 where convert(varchar(10), getdate(), 102 ) = convert(varchar(10), DateCreated, 102 ) and CounterName = @counterNameElseInsert Into MyTable (DateCreated, CounterName, counterHits) Values (getdate(), @CounterName, 1)

It will then show the image ... I'm suggesting a server.transfer for that.
0
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

ssanghavi82Author Commented:
yeah thats fine. But my main concern is Counter.aspx file ..... not database related.

Let me explain .....

Can u give me a sample code snippet for counter.aspx which will

pass counter names ..... dnt knw how 2 input counter names .... but only 1 counter name should be passed in the url ..... so i shd use cookie or querystring eg /counter.aspx?name=countername .......

but i m only required to used 1 aspx page so this page should pass as well as recieve the counter name
1. Counter.aspx should pass countername eg /counter.aspx?name=countername (any 1 counter name)
2. Now this counter name should be incremented in database ....
3. Then a single pixel image will be shown as a response ....
4. if /coutner.aspx?admin=password is passed then show summary on front end .....

so should i use a textbox to collect the counter name a button to pass the name of counter to the same page and then once the button is clicked show him a single pixel image .....

let me knw on my thoughts ....

thanks
0
Daniel WilsonCommented:
1. querystring, not cookie
2. My SQL code above handles that
3. try Server.Transfer(MyImage.gif)
4. do an If statement based on your querystring.  See http://www.java2s.com/Code/ASP/Request/DealwiththequerystringVBnet.htm for ASP.Net querystring usage.
0
ssanghavi82Author Commented:
I had a question .....

Do u have a sample code where

/counter.aspx?name=countername ..... counter name

is the url and my code reads this querystring .... once it takes the counter name ..... it should store that in database ..... if the counter name is repeated then it will just update the counter hit ....  Expect there could be 1 or there could be 1,000,000.  Your app should be able to handle n number of counters.

0
ssanghavi82Author Commented:
no sorry let me reframe what i actually want

say i have 50 oages on a web app calling counter.aspx .... each with a different counter name ...
The idea is to track how many hits occur on each counter.  Imagine you were tracking hits to your web site.  Youd want to see how many page loads you had across your site
0
Daniel WilsonCommented:
Sample code for the query string -- see the link at #4 in my last post.

SQL code to either update or insert to the DB -- see the code I put in bold in my second post.

Start writing your page ... write what you know ... start with comments telling what you're trying to do, fill in the code you know ... when you get stuck post it and ask your questions.

You're going to find this isn't as hard as you think.
0
ssanghavi82Author Commented:
I have to pass name with a null parameter , after that when we see the /Counter.aspx?name= url on the browser the user will give some name and then hit enter

I have 2 then collect this parameter ....

pls suggest an implementation.

 for eg ....

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            QueryString();
     
           
        if (Request.QueryString["name"].ToString() != null)
          {
                string strName = Request.QueryString["name"].ToString();
                //do corresponding work

         }

        }
    }

    protected void QueryString()
    {

        Response.Redirect("Counter.aspx?name="+ "");

    }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.