|
i forgot to add '=' symbol after '<%' take below like working
var textValue = document.getElementById('<%=txtComments.ClientID%>').value;
This is Example simple code to check, you take new page add the code after page directive run this page u will find the output . for futher help contact sk.haneef@gmail.com
<title>Untitled Page
<asp:textbox runat="server" id="txtComments" text="Test Message" xmlns:asp="#unknown">
alert(document.getElementById('<%=txtComments.ClientID%>'));
var textValue = document.getElementById('<%=txtComments.ClientID%>').value;
alert(textValue);
|
|
|
|
|
Hi
im using asp.net login control on my website
what im trying to is....
automaticaly check wheather someone login or not on default page . If not login then page will automatic redirect to login.aspx and after login page will redirect to default page. I dont want to click login to go to login.aspx
Any instruction or example will be helpful
Thanks in advance
Sarfarj Ahmed
|
|
|
|
|
What i understand from you statement is that if a user is not logged in to the site it should redirect to login.aspx page.
I would recommend you to read forms authentication and use it.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Thnaks for ur quick reply
My master page is alraedy authinticated, if i run my website then page redirecting to login.aspx and i used the code below in master page load event
If MasterLoginView.LoggedInTemplate IsNot Nothing Then
Response.Redirect("login.aspx")
End If
on my login page i used the following code
If UserNameIsValid AndAlso PasswordIsValid Then
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
End If
problem is,
LoggedinTemplate showing the login name but not redirecting , still on login.aspx
i changed web.config
<authentication mode="Forms">
<forms cookieless="UseUri" timeout ="10" slidingExpiration ="true"/>
</authentication >
thanks
Sarfarj Ahmed
|
|
|
|
|
Hi guys
I am working a shopping card application
there is a quantity option in which when 0 or -1,-2 enter no validation is fire
after page refareshing its working properly
what is the problem any one plz help me
my html code are as
<asp:requiredfieldvalidator font-size="XX-Small" id="RequiredFieldValidator1" runat="server" controltovalidate="txtqty" errormessage="*" xmlns:asp="#unknown">
<asp:textbox id="txtqty" runat="server" maxlength="3" style="width: 33px;" value="<%# Eval(" qty")="" %>"="" xmlns:asp="#unknown">
<asp:rangevalidator id="RangeValidator1" font-size="XX-Small" runat="server" controltovalidate="txtqty" xmlns:asp="#unknown">
ErrorMessage="Invalid Number" MaximumValue="999" MinimumValue="1" Type="Integer">
krishna veer singh
|
|
|
|
|
set the autopostback property of text box to true
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
NO ITS NOT WORKING
ANY OTHER SUGGESTION
krishna veer singh
|
|
|
|
|
i want to upload/download files from SSH server using SFTP. can anyone tell me Is there any free .NET component available for SFTP ?
|
|
|
|
|
I am writing a rather complex web application which has 2 distinct stores of "Users" who must be able to access said app. Think of these users as either Internal and External. Essentially at the moment they are stored in 2 different Sql2005 db's.
I have implemented 6 classes, inheriting from the relevalnt classes in System.Web.Security namespace
InternalMembershipUser
InternalMembershipprovider
InternalRoleProvider
ExternalMembershipUser
ExternalMembershipprovider
ExternalRoleProvider
They do they're job perfectly. I initially had just one configured in my web.config, using FormsAuthentication and everything worked hunky dorey. Now I can configure the second one in my web.config, and have 2 separate login forms (in fact the built in asp:Login control lets you specify the membership provider to use). So now both types of user can log in.
My problem arises when I try to use a call to HttpContext.Current.User.IsInRole(string) . This always uses the default RoleProvider so if you've logged in as an ExternalUser its using the InternalRoleProvider (default) rather than ExternalRoleProvider. This does make sense as there appears no way to associate a membership provider to a RoleProvider. Im hoping im wrong there but I dont think there is.
So my question is does anyone have any idea how I can force a RolePrincipal (which is what IPrincipal you get with FormsAuthentication) to use a specified RoleProvider?
thx
|
|
|
|
|
J4amieC wrote: So my question is does anyone have any idea how I can force a RolePrincipal (which is what IPrincipal you get with FormsAuthentication) to use a specified RoleProvider?
Perhaps write a simple HTTP module to do that? From what I can see this happens in the RoleManagerModule.
|
|
|
|
|
Thanks for the reply leppie,
I have an HttpModule that does some other unrelated security tasks, although I dont think you can replace the RoleManagerModule, essentially when you configure roles.enabled in the .config you get RoleManagerModule wholesale with no chance to point the roles object to a custom Module.
See answer to pete below about my current thinking on this problem.
|
|
|
|
|
The thing about the provider classes is that you're not just limited to the default implementations, so off the top of my head I would suggest that you add an interface to the membership providers, called (say) IMembershipExtension which you use to implement common functionality on the two providers. Use this to store the role provider that goes with which membership provider. Then, you can use this to call the relevant IsInRole directly (unfortunately, you can't do this using the HttpContext.Current.User.IsInRole - you have to get the user and perform a bit of casting for the role provider).
We do something a bit like this with an extended version of the role provider and it works pretty well.
|
|
|
|
|
Thanks Pete,
Im currently exploring the possibility of adding some context to the FormsIdentityTicket's UserData to indicate which type of user we have logged in, and in a custom HttpModule replacing the HttpContext.Current.User (and Thread.CurrentPrincipal) with my own implementation of IPrincipal, still wrapping the FormsIdentityTicket, but having specific behaviour for each type of user.
That way I should be able to call HttpContext.Current.user.isInRole and fingers crossed.....
|
|
|
|
|
That could work, and it should allow you to use the PrincipalPermission where necessary (if you currently do).
|
|
|
|
|
OK - who the hell 1 voted this? Oh well - I'll 5 to compensate.
|
|
|
|
|
HI ALL
i am calculating irr and pass listarray created at runtime to irr function and i get error. as i'm new to .net
i have to calculate irr
textbox2.text specify the no installments
textbox1.text specify loan amount
textbox5.text specify the amount of installments
Dim i As Int16
Dim pay As New ArrayList()
For i = 0 To TextBox2.Text
pay.Add(TextBox5.Text)
Next
pay.Add(-TextBox1.Text)
Dim ir As Double
ir = Math.Round(Microsoft.VisualBasic.Financial.IRR(pay (TextBox2.Text + 1), 0.1), 2)
TextBox7.Text = ir
GET THIS ERROR MESSAGE
Unable to cast object of type 'System.Double' to type 'System.Double[]'.
|
|
|
|
|
Hi all
How to convert any type of audio or video file in to an swf extension and play it in a browser. I have searched a lot on net but in vain . My last hope is this forum. Please help me. Thanks in advance.
|
|
|
|
|
You won't find any free utility in .net. You can use php for this specific purpose.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
hai all,
i am new to .net.i am using .net 2005.i do my project in asp.net.backend is sql2000.
all employee ids are stored in sql 2000 database.
i want to get all employee ids from database and stored into single array name.then using that array name,i want to display the details of all employee ids in datagridview....how to do this?....
thanks in advance...
|
|
|
|
|
why do you want to store it in array? store it datatable instead
|
|
|
|
|
I want to show a dicom image file in asp net 2.0. Can anyone provide some help.......
Do good and have good.
|
|
|
|
|
hi
i want upload file on server.
and how to download it.
gayatri
Gayatri
|
|
|
|
|
niki_nilu wrote: i want upload file on server.
Use FileUpload control.
niki_nilu wrote: and how to download it.
Just redirect to that file. Response.Redirect("FileName.extension");
|
|
|
|
|
hi
yes i took input file control.
but where i will see that uploaded file.
my code is--
if (File1.PostedFile != null)
{
string StrFileName = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\\") + 1);
string StrFileType = File1.PostedFile.ContentType;
int IntFileSize = File1.PostedFile.ContentLength;
if (IntFileSize <= 0)
Response.Write("<font color='Red' size='2'>Uploading of file " + StrFileName + " failed </font>");
else
{
File1.PostedFile.SaveAs(Server.MapPath(".\\" + StrFileName));
Messagebox.Show("Your file was uploaded successfully");
}
}
Gayatri
|
|
|
|
|
When you are using some one else code. Please try to understand it first.
File1.PostedFile.SaveAs(Server.MapPath(".\\" + StrFileName));
You are giving this path. So it will be uploaded there.
Ahsan Ullah
Senior Software Engineer
|
|
|
|