|
arun$aini wrote: Where is your login control?
Probably all that stuff we call html and server control tags, like textbox and button.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I thought he was talking about the asp.net login control.
|
|
|
|
|
So what issues/problems are you having? IMO login should not be done via ajax. The initial page should display only publicly accessible information, after authentication the user should be redirected to secured content.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for gving interest in my problem;
Language: C# with Asp.net using AJAX
After using the update panel including authentication Table(userName,Password)the following error occur; Wats the reason for this Error;
Sys.WebForm.PageRequestManagerParserErrorException:THis msg recieved from the server could not
be parsed.Common cause for this error are when the response is modified by calls to Response.Write(),
response filters,HttpModules.or server trace is Enabled.
Details:Erro parsing near' |<html> <Head> '.
|
|
|
|
|
Have you made sure the httpmodules for ajax have been added to the web.config?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes Sir I have already Added to the webconfig.
|
|
|
|
|
I'd go with my original response, you are gaining nothing in the login process by trying to use AJAX.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
What code you have written on Button1_Click1 event?
|
|
|
|
|
I have used this code;
protected void Button1_Click1(object sender, EventArgs e)
{
string str = "select * from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
OracleDataReader dr = dms_obj.GetDataReader(str);
if (dr.Read())
{
Session["username"] = txtuid.Text;
string sess = Convert.ToString(Session["username"]);
Session["password"] = txtpassword.Text;
string pass = Session["password"].ToString();
Label1.Visible = true;
Label1.Text = "Authentication Success";
txtuid.Text = "";
txtpassword.Text = "";
}
else
{
Label1.Text = "InValid UserName/Password";
txtuid.Text = "";
txtpassword.Text = "";
}
}
|
|
|
|
|
string str = "select * from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
Unvalidated user input placed directly into inline SQL? What's the point of having a login? Have you ever heard of SQL Injection attacks?
Session["password"] = txtpassword.Text;
NEVER, EVER store a password in memory!!
Session["username"] = txtuid.Text;
string sess = Convert.ToString(Session["username"]);
Session["password"] = txtpassword.Text;
string pass = Session["password"].ToString();
This is useless code. Put the text to Session variable then the Session variable to a local variable. You don't even use the local variables.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi iam using asp.net with c#
i want to display an default image from my website folder when there is no image in database , can you correct my code
<%@ WebHandler Language="C#" Class="left1" %>
using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web;
public class left1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string branchid = "";
if(context.Session["branchid"]!=null)
branchid= context.Session["branchid"].ToString();
else
throw new ArgumentException("No parameter specified");
context.Response.ContentType = "image/jpeg";
Stream strm = ShowImage(branchid);
byte[] buffer = new byte[4096];
int byteSeq = strm.Read(buffer, 0, 4096);
while (byteSeq > 0)
{
context.Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strm.Read(buffer, 0, 4096);
}
}
public Stream ShowImage(string branchid)
{
SqlConnection con = new SqlConnection(" Data Source=.; Initial Catalog=SafaView;User ID=sa;Password=nsg_ss_0103;");
string sql = "SELECT imgleft1 FROM tblImages WHERE BranchId = @BranchId";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@BranchId", branchid);
con.Open();
object img = cmd.ExecuteScalar();
try
{
return new MemoryStream((byte[])img);
}
catch
{
return null;
}
finally
{
con.Close();
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
in page load
=========
string id = "";
protected void Page_Load(object sender, EventArgs e)
{
id= Session["branchid"].ToString();
if (IsPostBack == false)
{
Image1.ImageUrl = "left1.ashx?BranchId="+id;
Image2.ImageUrl = "left1old.ashx?BranchId="+id;
}
i want to display a default image when there is no image in database
can you correct my code
|
|
|
|
|
My assumptions -
* Default image is also in the database
* BranchId is numeric
* Default image has the least possible BranchId say 0
Alter the query like so -
SELECT top 1 imgleft1 FROM tblImages WHERE BranchId in (@BranchId, @Default) order by BranchId desc
Add this line to the code
cmd.Parameters.AddWithValue("@Default", 0);
Now if the BranchId is available then that image would be displayed, else the default image would be displayed.
HTH!
|
|
|
|
|
Hello All,
I have a Web Application I am developing that has a GridView.
I have searched the internet to no avail looking for an answer to this.
The gridview has 11 columns. I want to hide the 11th column while in normal mode and make visible while in edit mode.
Here is my Code:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowState = DataControlRowState.Edit Then
GridView1.Columns(11).Visible = True
ElseIf e.Row.RowState = DataControlRowState.Normal Then
GridView1.Columns(11).Visible = False
End If
End Sub
My result from the above code is The 11th column is not visible in Normal mode but when I click the Edit button an error StackOverflowExceptionwasunhandled comes up.
What am I missing
Thanks!
Tommy
|
|
|
|
|
if your column is 11 in grid view than u need to hide 10 one because in grid column start from 0 as base index
so you code may be
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowState = DataControlRowState.Edit Then
GridView1.Columns(10).Visible = True
ElseIf e.Row.RowState = DataControlRowState.Normal Then
GridView1.Columns(10).Visible = False
End If
End Sub
For more help : pranayamr@gmail.com
|
|
|
|
|
Pranay,
I did take that in to account to be sure I did change to 10 see the result.
Its was the same but just on the 10th column.
I still get the StackOverflowExceptionwasunhandled
As if its looping but I don't understand why.
Thanks,
|
|
|
|
|
|
Dinesh,
I did find this however I am not too familiar with c#
If you could help translate this toe VB.net that would be fantastic.
Thanks,
Tommy
|
|
|
|
|
I've tried to translate the coding from C# to VB.NET. I think this is the equivalent -
Protected Sub GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
If (GridView1.EditIndex < 0) Then
Exit sub
End If
If ((e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) && (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)) Then
e.Row.Cells(2).Visible = False
e.Row.Cells(3).Visible = False
End If
End Sub
NOTE: I've not worked in VB.NET for sometime so go easy on me if it doesn't work
HTH!!
|
|
|
|
|
Hi,
grafiksinc
U just take the parameter as 10 in the columns of grid view and check the result.
Thanks.
pshimansu@gmail.com
|
|
|
|
|
Hello All,
Well I did try your suggestions howerver nothing worked. I think next time I will manually create the Table and writ ethe code rathe rthan use the Gridview for this tyoe of situation. With that said here is what i did.
1. Convert the column to a template
2. The columns that I want to hide - site the width to 0
3. In the ItemTemplate just remove the text so that the column title is is blank
4. On the ASP: Code set GridLines = None
5. In the edit template Put the text/check box you want to use
Doing the above steps allowed me to hide the columns in "Normal mode" and have them show in edit mode.
Thanks guys for all the help,
Tommy
|
|
|
|
|
hi all i have used an open source cms named "kentico cms".i have integrated
it locally at my system it successfully exexcuted but when i uploaded it online it is giving me following error:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
how can i upload it online.plz help its urgent...
the process which i have folowed is corect or wrong..
thanks ....
|
|
|
|
|
Your web site probably does not support anonymous logon.
If this is a company website, you should talk to the administrator to see which authentication methods are support, and how to configure them. Also read up on the documentation of your CMS.
If this is hosted website, search the documentation of your hosting provider.
|
|
|
|
|
hoe to print a report by default in landscape mode by using reportwizard?
|
|
|
|
|
Is it possible to convert a Website project type to a Web application project type without starting over from scratch with a new solution? If so, how?
SOLUTION: There is apparently no one-click tool available to perform this conversion. So I just bit the bullet and sat down and created a new solution and built it up from scratch until it was a Web application project equivalent to my original Website project. It took me about four hours with no "gotchas" to solve that I might have run into had I adopted one of the partial solutions that are out there and actually referenced in one of the answers to my question.
I performed the conversion in the following steps, basically moving from the lowest level to the highest level, compiling at each step. This minimized compile errors due to undefined objects, although I couldn't entirely eliminate them because sometimes low level objects referenced high level objects (I know: bad design; but it isn't too egregious, and I had very few of these).
1. Created a new solution of type, Web application project.
2. I ported the .Web project first, which contains my WCF Web service.
3. Then I ported my utility classes in my Silverlight project.
4. I had my pages divided into categories that were more or less in a hierarchy, and I ported the lowest categories in the hierarchy first, and worked my way up. I had very few unresolved symbols doing it this way.
5. Finally, the few compile errors I had got resolved when I ported my MainPage, the last object to port.
Along the way of course I had to add a few references, but compile errors quickly notified me when I had to do this. The new solution now works exactly like the original.
Why did I do this in the first place? I did it because the Website project type requires you to put your .Web project source code up on your Website! This has things like my connection string (with password!) right out there in plain site for anybody to see, as well as proprietary algorithms generating and validating license keys.
Oh, I know: there's a precompilation tool called aspnet_compiler.exe that will compile this code for you and after that you can obfuscate it, but in Googling about it, it looks as if you have to jump through hoops to get it to work for you. There are also better approaches than putting your source code in a folder (App_Code) off the root of your Website, like putting it into a protected subdomain, but I'm really green at all this Web development stuff and I just want to get something out there I can test as quickly as possible. I'll perform these niceties at my leisure once everything is otherwise working.
modified on Wednesday, May 12, 2010 4:58 PM
|
|
|
|
|