|
The only problem is that my Master page also paint an lower icon bar for all the pages, so the content page comes in the middle and depending of it´s size it makes the Master change it's appearance, but I´ll check about Flow Layout
|
|
|
|
|
Hi,
I failed to manage roles by code and web confg. so I used the code easily I have a table Security of my database (login,password,profil) and a login.aspx page and I need to open pages in each service to the people of this service .is this correct? can I combine the files into folders?
I must change the file wb.config?
my code:
protected void Button7_Click(object sender, EventArgs e)<br />
{<br />
SqlConnection aCon = new SqlConnection(@"Data Source=.\SQLEXPRESS;UID=sa;Password=******;Initial Catalog=xxxxx");<br />
<br />
<br />
aCon.Open();<br />
String rqtr3 = " SELECT * FROM SECURITE WHERE LOGIN = '" + Textbox3.Text + "' AND PASSWORD='" + TextBox12.Text + "'";<br />
SqlCommand cmr3 = new SqlCommand(rqtr3, aCon);<br />
SqlDataReader drr3 = cmr3.ExecuteReader();<br />
<br />
while (drr3.Read() == true)<br />
{<br />
TextBox2.Text = drr3["PROFIL"].ToString();<br />
if (TextBox2.Text == "service1")<br />
{<br />
Response.Redirect("default1.aspx");<br />
}<br />
else<br />
{<br />
if (TextBox2.Text == "service2")<br />
{<br />
Response.Redirect("default2.aspx");<br />
}<br />
<br />
else<br />
{<br />
if (TextBox2.Text == "service3")<br />
{<br />
Response.Redirect("default3.aspx");<br />
} <br />
else.........<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
}
Thanks.
|
|
|
|
|
First, absolutely NEVER, EVER use unvalidated user input in your SQL statements. This is even more hanous because you are querying the security database. Lookup a term called 'SQL Injection attack'.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
even with an intranet? you advise me what?
Thanks
|
|
|
|
|
Even more so, most attacks occur from the inside
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Role based security is also available out of the box with ASP.NET
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks a lot Mark Nischalke and Jinal Desai - LIVE,
I used the link but when I login I have this message: Username / password incorrect. Please try again.(password and database connection are just)
I think that I have a problem with the web config.
Mark Nischalke I do not understand:Role based security is also available out of the box with ASP.NET.
thanks
modified on Monday, July 12, 2010 11:20 AM
|
|
|
|
|
|
Thanks Mark Nischalke,
I still have the same problem(with the previous link)and even using visual studio 2008 menu web site / asp.net configuration...Username / password incorrect. Please try again.
i dont know if i have a problem in visual studio or what?
thanks (sorry i dont speak english well)
|
|
|
|
|
|
Are you seriously asking to modify the client's screen resolution from ASP.NET? No, you can't do this.
Explore your layout options. Look at relative CSS formatting (width: 80%; vs. width: 800px). At worst, discover the client's resolution and adjust.
From http://particletree.com/features/dynamic-resolution-dependent-layouts/[^]
In Javascript...
function getBrowserWidth(){
if (window.innerWidth){
return window.innerWidth;}
else if (document.documentElement && document.documentElement.clientWidth != 0){
return document.documentElement.clientWidth; }
else if (document.body){return document.body.clientWidth;}
return 0;
}
Also find following links useful.
http://devcity.net/Articles/64/1/screenresolution.aspx[^]
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
|
When you are trying to access the value of textbox??
After submitting the page, on which you have changed the value of textbox....
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi coders,
Currently I have encountered a very strange issue in my code. The summary is as follows:
Page1.aspx
<form id="frm" name="frm" action="Default.aspx" method="post">
.
.
.
.
</form>
<script language="javascript">
window.document.frm.submit();
</script>
Default.aspx
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
TextBox1.Text = "Posted Back";
else
TextBox1.Text = "Normal senario";
}
While going to Default.aspx using upper method, TextBox1.Text is comming "Posted Back" . That means IsPostBack property is set to TRUE even when going to the Default.aspx for the first time.
Can anyone please guide me why this happen?? and what should I do to get rid of this issue??
Thank You,
Anand Desai
modified on Monday, July 12, 2010 7:43 AM
|
|
|
|
|
I think the following line is re-submitting the page.
<script language="javascript">
window.document.frm.submit();
</script>
So, when it is loading the page at first time it is detecting page postback.
You can put submitting form inside condition or function and call the function whenever
you want to submit the form.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Jinal Desai - LIVE wrote: I think the following line is re-submitting the page.
No no..... You misunderstood. the HTML code I posted was of another page (say Page1.aspx ). And from that I am moving to Default.aspx using Form.Submit()
both page are diffrent, so while going to Default.aspx , I am jumping to it first time ever and so it should give IsPostBack = "False"
|
|
|
|
|
No I think you misunderstand. The html you have shown has the form action as default.aspx and the Javascript is submitting the form which will cause a postback.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: The html you have shown
The HTML I have shown is from Page1.aspx not Default.aspx ....
Both are diffrent .aspx Pages.
From Page1.aspx , I am moving to Default.aspx . Still it will give IsPostBack = "True" at 2nd Page???
|
|
|
|
|
Are you sure? the way I see it, the javascript on his HTML page is submitting the form on that page which, by it's "action" is calling his default.aspx page - and that will not call the postback.
I suspect his problem is that he hasn't properly defined IsPostBack - doesn't he need "Page.IsPostBack" in his If statement? (or Me.IsPostBack or something - sorry, not really conversant with C#)
|
|
|
|
|
See my modified question. This will elaborate my issue better I suppose.
|
|
|
|
|
NeverHeardOfMe wrote: not really conversant with C#
You don't have to be conversant in C#, or VB.NET, IsPostBack is a property of the Page object so you don't specifically need Page.IsPostBack
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
oops, yes - gosh that was dumb of me.
(Hey, it's Monday...)
|
|
|
|
|
See my modified question. This will elaborate my issue better I suppose.
|
|
|
|
|
You don't seem to understand. When navigating to form1.aspx in your browser the page will load, then the javascript will execute causing the form to be submitted. The form action is set to default.aspx so it will receive the postback.
If you want to display default.aspx immediately, then go there. Default.aspx is well, default, IIS should be configured out of the box to go to default.aspx when no other page has been specified in the request.
I know the language. I've read a book. - _Madmatt
|
|
|
|