私はショッピングカートWebアプリケーションを持っています。ローカルマシンでうまく動作しているときに実行します。私はオンライン私のアプリケーションをホストされているときに私は、ログインして自動的にサインアウトし、ログインページにリダイレクトされ、いくつかの時間後に、ユーザー自分のアプリケーションを使用する場合でも、私は2つの問題配備の問題asp.net Webアプリケーション
- に直面しています。
- のDataListコントロールによって取得され、示される画像の一部示されていないテキストだけは、私は、ユーザー
自分のWebログインのための方法FormsAuthentication.RedirectFromLoginPage(ユーザ名、true)を使用しています
を示しています.configファイルは
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="shopingConnectionString1" connectionString="workstation id=shoppingpra.mssql.somee.com;packet size=4096;user id=pramuk98;pwd=kumarjha;data source=shoppingpra.mssql.somee.com;persist security info=False;initial catalog=shoppingpra"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms defaultUrl="default.aspx" loginUrl="login1.aspx" timeout="1000000" cookieless="AutoDetect" ></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
され、ログインページのコードは、私が
User Name<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="fill usename "></asp:RequiredFieldValidator>
<br />
Password<br />
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="fill password"></asp:RequiredFieldValidator>
<br />
<asp:ImageButton ID="ImageButton3" runat="server" AlternateText="sign in"
onclick="ImageButton3_Click" ImageUrl="~/img/str/buttons/sign in.bmp" />
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
int flag = 0;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shopingConnectionString1"].ConnectionString);
string s = "select * from login";
SqlCommand com = new SqlCommand(s, con);
con.Open();
if (con.State == ConnectionState.Open)
{
SqlDataReader dtr;
dtr = com.ExecuteReader();
while (dtr.Read())
{
if (dtr[0].ToString().Equals(TextBox1.Text) && dtr[1].ToString().Equals(TextBox2.Text))
{
flag = 1;
Response.Cookies["uname"].Value = TextBox1.Text;
Response.Cookies["pwd"].Value = TextBox2.Text;
Response.Cookies["role"].Value = dtr[2].ToString();
FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
}
else
{
Label1.Text = "your credential are incorrect";
}
}
を使用しています
をあなたのweb.configファイルにマシンキーを追加したり、このオンラインツールを使用して、非常に簡単です。 – iandayman
タイムアウト値が私のために働いていません –