By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,899 Members | 1,230 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,899 IT Pros & Developers. It's quick & easy.

How to deploy asp.net application in asphostportal.com server

P: 2
I have created a subdomain in which my asp.net appln files are stored in asphostportal.com.

I have created a c# file to create namespacing for refering connection and dataset.

includes.cs (for creatomg namespace Logic)

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;
  10. using System.Data.SqlClient;
  11. namespace Logic
  12. {
  13.  
  14.  public class Includes
  15.  {
  16.         public void executeQuery(string strsql)
  17.         {
  18.             string conn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
  19.  
  20.             SqlConnection con = new SqlConnection(conn);
  21.             SqlCommand cmd = new SqlCommand(strsql, con);
  22.  
  23.             try
  24.             {
  25.                 con.Open();
  26.                 cmd.ExecuteNonQuery();
  27.  
  28.             }
  29.             catch (Exception ex)
  30.             {
  31.                 throw ex;
  32.             }
  33.             finally
  34.             {
  35.                 con.Close();
  36.                 con.Dispose();
  37.                 cmd.Dispose();
  38.             }
  39.  
  40.         }
  41.  
  42.         public DataSet getDataSet(string strsql)
  43.         {
  44.  
  45.             string conn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
  46.             SqlConnection con = new SqlConnection(conn);
  47.             SqlCommand cmd = new SqlCommand(strsql, con);
  48.             try
  49.             {
  50.                 con.Open();
  51.                 SqlDataAdapter ad = new SqlDataAdapter(cmd);
  52.                 DataSet ds = new DataSet();
  53.                 ad.Fill(ds);
  54.                 return ds;
  55.  
  56.             }
  57.             catch (Exception ex)
  58.             {
  59.                 throw ex;
  60.             }
  61.             finally
  62.             {
  63.                 con.Close();
  64.                 con.Dispose();
  65.                 cmd.Dispose();
  66.             }
  67.         }
  68.     }
  69.  
  70.  
  71. }
I am refering this namespacein my code

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using Logic;
  12. using System.Data.SqlClient;
  13.  
  14.  
  15. public partial class test : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.  
  20.     }
  21.     protected void Button1_Click(object sender, EventArgs e)
  22.     {
  23.         Includes obj = new Includes();
  24.         string uname = uid.Text.Trim();
  25.         string pass = pwd.Text.Trim();
  26.         string sql = "select user_id,user_pass,user_status from user_master where user_id='" + uname + "' and user_pass='" + pass + "'";
  27.         DataSet ds = obj.getDataSet(sql);
  28.         int ctr=ds.Tables[0].Rows.Count;
  29.  
  30.         if (ctr > 0)
  31.         {
  32.             string stat = ds.Tables[0].Rows[0]["user_status"].ToString();
  33.             if ( ds.Tables[0].Rows[0]["user_status"].ToString()== "Y")
  34.             {
  35.                 Response.Redirect("main.aspx");
  36.  
  37.             }
  38.             else
  39.             {
  40.                 Response.Redirect("index.aspx");
  41.  
  42.             }
  43.  
  44.  
  45.         }
  46.         else
  47.         {
  48.             Response.Redirect("index.aspx");
  49.  
  50.         }
  51.  
  52.  
  53.  
  54.     }
  55. }
at last my web.config

Expand|Select|Wrap|Line Numbers
  1. <connectionStrings>
  2. <add name="conn" connectionString=" Server=xxx.db.xxxx.hostedresource.com; Database=xxx; User ID=xxx; Password=xxx; Trusted_Connection=False" providerName="System.Data.SqlClient" /> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString=" Server=xxx.db.xxxx.hostedresource.com; Database=xxx; User ID=xxx; Password=xxx; Trusted_Connection=False" providerName="System.Data.SqlClient" />
  3. </connectionStrings>
  4. <configuration>
  5. <system.webServer>
  6. <httpErrors errorMode="Detailed" />
  7. <asp scriptErrorSentToBrowser="true"/>
  8. </system.webServer>
  9. <system.web>
  10. <customErrors mode="Off"/>
  11. <compilation debug="true"/>
  12. </system.web>
  13. </configuration>
<div> </div> <div> </div> <div> </div> <div> </div> <div> </div> <div>

Please I need help
Jun 23 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.