?
Solved

Help to design this requirement

Posted on 2008-11-10
9
Medium Priority
?
167 Views
Last Modified: 2012-05-05
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


0
Comment
Question by:ssanghavi82
  • 5
  • 4
9 Comments
 
LVL 32

Assisted Solution

by:Daniel Wilson
Daniel Wilson earned 2000 total points
ID: 22924878
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
 

Author Comment

by:ssanghavi82
ID: 22924947
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
 
LVL 32

Assisted Solution

by:Daniel Wilson
Daniel Wilson earned 2000 total points
ID: 22925147
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ssanghavi82
ID: 22925231
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
 
LVL 32

Assisted Solution

by:Daniel Wilson
Daniel Wilson earned 2000 total points
ID: 22925349
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
 

Author Comment

by:ssanghavi82
ID: 22925667
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
 

Author Comment

by:ssanghavi82
ID: 22925700
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
 
LVL 32

Assisted Solution

by:Daniel Wilson
Daniel Wilson earned 2000 total points
ID: 22925732
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
 

Accepted Solution

by:
ssanghavi82 earned 0 total points
ID: 22928090
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question