0

I am working on this website of mine in asp.net c# where the data is fetched through the SQL server. and it was working fine till Saturday but now i am getting DIV's getting generated in the data, which i am bringing from database in different sections like country and city and state dropdown.I am attaching an image to show u the div's. Image regarding the error whenever even if i am editing the data ,it generates this tags all over the data, and are getting stored.

Kindly help me out with this.Thanks in advance.

the Code file is

protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlCountry.SelectedValue == "")
        {
            ddlState.SelectedIndex = 0;
            ddlCity.SelectedIndex = 0;
            ddlState.Enabled = false;
            ddlCity.Enabled = false;
            ddlCountrycode.SelectedIndex = 0;
            ddlCountrycode.Enabled = false;
        }
        else
        {
            ddlState.Enabled = true;

            DataSet ds = Data.spGetStateByCountryId(Convert.ToInt32(ddlCountry.SelectedValue));
            ddlState.DataSource = ds;
            ddlState.DataTextField = "StateName";
            ddlState.DataValueField = "State_Id";
            ddlState.DataBind();

            DataSet ds1 = Data.spGetCountrycode(Convert.ToInt32(ddlCountry.SelectedValue));
            ddlCountrycode.DataSource = ds1;
            ddlCountrycode.DataTextField = "CountryCode";
            ddlCountrycode.DataValueField = "Country_Id";
            ddlCountrycode.DataBind();

            ddlCity.SelectedIndex = 0;
            ddlCity.Enabled = false;
        }
    }

and the i am populating the dropdown with this code.

 private void PopulateContinentsDropDownList()
    {
        DataSet ds = Data.spGetCountries();
        ddlCountry.DataSource = ds;
        ddlCountry.DataTextField = "CountryName";
        ddlCountry.DataValueField = "Country_Id";
        ddlCountry.DataBind();

        ListItem liCountry = new ListItem("Select Country");
        ddlCountry.Items.Insert(0, liCountry);

        ListItem liState = new ListItem("Select State");
        ddlState.Items.Insert(0, liState);

        ListItem liCity = new ListItem("Select City");
        ddlCity.Items.Insert(0, liCity);

        ListItem liCountryCode = new ListItem("Country Code");
        ddlCountrycode.Items.Insert(0, liCountryCode);

        ddlState.Enabled = false;
        ddlCity.Enabled = false;
    }

the image for the page where all this is added is Image of dropdownlist

Neerav Poriya
  • 23
  • 1
  • 10
  • How could you expect someone to answer this with this much details? – Imad Jul 04 '16 at 09:21
  • Sorry for the short detail .here is my cs file code – Neerav Poriya Jul 04 '16 at 09:30
  • sorry for that ,i have edited the question with the details – Neerav Poriya Jul 04 '16 at 09:37
  • 1. Are you sure your DB has data without Divs? 2. Are you using third party drop down controls? – Imad Jul 04 '16 at 09:43
  • Yes,when i entered the data it was without the div tags but now this div are getting generated while i edit or enter a new customer in my page and same divs are getting stored in my database tables as well – Neerav Poriya Jul 04 '16 at 09:54
  • I would concentrate on looking at the Markup of your page. There's probably a character that has crept in that you have not catered for in the data and is effecting the markup. If your data really is being stored with Markup, then the first thing you need to do is clean the data, so that you have a fresh starting point to debug from – bilpor Jul 04 '16 at 10:09
  • Is www.myvisajobs.com your site? Looks like your server may have been hit with a virus or malware if not. The div is hidden and creating a link to the site, possibly in an effort to improve search rankings. – Michael Jul 04 '16 at 11:22
  • No @Michael 7 that is not my site and i think you are right and i am checking for the same problem currently for the sql injection. Thanks a lot. – Neerav Poriya Jul 04 '16 at 11:30
  • I moved the comment to the answer, let us know how it works out. I suggest you change your admin password in the database asap. – Michael Jul 04 '16 at 11:38

2 Answers2

0

The additional divs may be the result of a SQL injection attack or other malicious code (especially if the site referenced is not yours). Try and install the code in a clean environment to see if the problem persists.

Michael
  • 188
  • 6
0

MSSQL Server injected with hidden spam links, any ultimate solution?. Well i found something useful. So sharing it over here and will try it and update soon

Community
  • 1
  • 1
Neerav Poriya
  • 23
  • 1
  • 10