|
The best practice is to store role in db but you can also store in dictionary<string uname,="" string="" role="">
|
|
|
|
|
Thank you so much for your response. Is their a way to group or name the queries, so i can compute the following logic:
if (user & password match from full query)
{
return string = "full status"
}
else
{
return string = "trial status"
}
Is their some function or framework i could look into. please help.
Thank you
|
|
|
|
|
You can simply use switch case. Or its better if you can share your both the queries.
|
|
|
|
|
Hi, thank you for your reply back and you suggestion on 'switch back'. I will look into this function.
Currently this what my queries look like:
public User trial(string username, string password)
{
string[] roles = new string[] { "trial"};
var query = from s in db.Subs
join u in db.Cust on s.sUID equals u.uID
where s.sExpiryDate >= DateTime.Now &&
u.uUsername == username &&
u.uPassword == password
select u;
return query.FirstOrDefault();
}
public User full(string username, string password)
{
string[] roles = new string[] { "full"};
var query = from s in db.Subs
join u in db.Cust on s.sUID equals u.uID
u.uUsername == username &&
u.uPassword == password
select u;
return query.FirstOrDefault();
}
Any help or suggestion, would be really appreciated. Thanks in advance.
|
|
|
|
|
In .ascx
===========
<div id="Divwatermark" class="watermark" visible="true" runat="server">
<p align="center">Cancelled</p>
</div>
Code Behind
=================
if True then
Divwatermark.Visible = True
Else
Divwatermark.Visible = False
End If
Even after the IF condition evaluates to TRUE and Divwatermark.Visible = True is getting executed, Divwatermark.Visible remains FALSE. Help me how to set the visibility of Divwatermark TRUE. Thanks in advance.
Nandan Basak
|
|
|
|
|
Hi,
I trying to display Videos which are private and will be displayed only on my website or when I login to Youtube. Can anyone help me in this regard.
|
|
|
|
|
Hello Experts,
This is my very first post here. so, please take easy on me.
I wrote a stored proc that takes 4 parameters and inserts into the db.
I have tested it using SSMS and it works great but I can't get it work with my .net app.
No errors but just doesn't work.
This is supposed to go live on Tuesday and I must give a demo by Monday.
The insert bit is the last task and is supposed to be easy.
Can someone please help?
Code is below and thanks a lot in advance.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim questld As HiddenField = DataList1.FindControl("HiddenField2")
For Each item As DataListItem In DataList1.Items
If item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem Then
Dim positionid As Integer
Dim choiceid As Integer = 0
Dim choicetext As String = ""
'positionid = CType(item.FindControl("Label3"), Label).Text
positionid = CType(item.FindControl("HiddenField2"), HiddenField).Value
Dim anstype As HiddenField = item.FindControl("HiddenField1")
Select Case anstype.Value
Case "S"
Dim rbl As RadioButtonList = item.FindControl("RadioButtonList1")
choiceid = rbl.SelectedValue
SaveVotes(positionid, choiceid, choicetext, "")
Case "M"
Dim cbl As CheckBoxList = item.FindControl("CheckBoxList1")
For i As Integer = 0 To cbl.Items.Count - 1
If cbl.Items(i).Selected Then
choiceid = cbl.Items(i).Value
SaveVotes(positionid, choiceid, "NA", "")
End If
Next
Case "T"
Dim txt As TextBox = item.FindControl("TextBox1")
choicetext = txt.Text
SaveVotes(positionid, 0, choicetext, "")
End Select
End If
Next
DataList1.Visible = False
End Sub
Private Sub SaveVotes(ByVal qid As Integer, ByVal cid As Integer, ByVal ct As String, ByVal cuser As String)
Dim al As ArrayList = CType(Session("AnswerList"), ArrayList)
'Dim s As String
If al Is Nothing Then
Response.Redirect("Thanks.aspx")
End If
Dim connStr As String = ConfigurationManager.ConnectionStrings("BallotsConnectionString").ConnectionString
Dim conn As New SqlConnection(connStr)
Dim cmd As New SqlCommand("InsertBallots", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim p1 As New SqlParameter("@qid", qid)
Dim p2 As New SqlParameter("@cid", IIf(cid = 0, DBNull.Value, cid))
Dim p3 As New SqlParameter("@ct", IIf(ct = "", DBNull.Value, ct))
Dim p4 As New SqlParameter("@cuser", Session("UserName"))
cmd.Parameters.Add(p1)
cmd.Parameters.Add(p2)
cmd.Parameters.Add(p3)
cmd.Parameters.Add(p4)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
End Sub
modified 15-Mar-14 19:57pm.
|
|
|
|
|
>> No errors but just doesn't work
really ? there are always errors - you just need to know where to look
first off, not that it will likely show much, is that ExecuteNonQuery() does return an Int32 value for RowsAffected - that you arnt looking at - I would be irrespective of other issues
So, the real crux is, have you checked wether your database user (that you are likely connected to the database with) has permissions to the database and execute sql/stored procs ?
I would be looking at the database and event logs ....
Im always suspicious of connections to databases - so while you're trying to get it to work, after your
conn.Open()
I would add something like
Console.WriteLine("State: {0}", conn.State) and set a breakpoint on that line so I could check for sure
I cant think of anything else obvious though
|
|
|
|
|
Garth, thank you very much for your assistance.
Yes, I have checked for permission.
I logged into the db with same account that the app is using.
I was able to insert and delete records using that account.
So, I can confidently rule that out.
I do want to point out sir that when I commented these lines out:
'If al Is Nothing Then
' Response.Redirect("Thanks.aspx")
'End If
I was able to begin to insert records into the database.
My question is why did it work with my other app and not with this current app project.
Also, for some reason, I am having problems deleting the records that I inserted.
Reason I am mentioning this is if it has anything to do with the lines I commented out. It doesn't to from the look of things.
I will add the line you asked to, test and report back.
I wish there was a way to rewrite this entire code, the button1_click portion of it.
That will give me more control.
|
|
|
|
|
I have solved it by rewriting the stored proc.
That was the culprit. I suppose you are right and thanks for pointing to that direction.
|
|
|
|
|
Hi
I'm coding an application sort of a chat. but the challenge that I'm facing is. How do I allow more than one user to login in my browsers IE and Crome in my PC?
|
|
|
|
|
How to implement facebook share functionality using jQuery ???
any thoughts ???
Thanks
|
|
|
|
|
|
Hi,
I have implemented facebook share button functionality in my application using below code. But that is not working in my application. can u provide some suggestion to solve this prob.
Snippet:
http://www.facebook.com/sharer.php?s=100&p[url]" + DomainName + "&p[images][0]=" + ImgUrlValue + "&p[title]=" + ProductDesc + "&p[summary]=" + product summary.
|
|
|
|
|
this is 3rd re-post so far. stop that.
|
|
|
|
|
Master page :
there is a script manager in master page. In child page i am trying to trigger button's server click event. i can call jquery click event on its click..i cant' call its server side event
Content page :
<asp:button id="btnSignup" runat="server" text="Create Account" cssclass="button cta btn btn-primary btnSignup" onclick="btnSignup_click">
protected void btnSignup_click(object sender, EventArgs e)
{
}
am i missing anything ?
|
|
|
|
|
instead of önserverclick use onclick and still if it doesn't work then put everything under <updatepanel><contenttemplate>
|
|
|
|
|
Hi Techies
I cached a page using the directive and attribute VarByParam.It worked fine and my problem is I am having a web page with a Panel control and inside the panel two text box were used and the ID for those text box are txtTest1 and txtTest2 with the text Test1 and Test2 respectively. All my need is to partially cache this particular panel along with their child controls and its value means the two textboxes and its text. Please give me the solutions.
Note: User Control should not be used
modified 16-Mar-14 23:12pm.
|
|
|
|
|
I used some examples but doesn't work on the computer or movil device.
when i run the proyect (f5) in the proyect this code works but when i go to chrome or explorer directly doesn't work. How can i do.....
This is the code.
one:
Dim player As New System.Media.SoundPlayer
player.SoundLocation = ("c:\sonidos\error.wav")
player.Play()
two:
Dim sp As SoundPlayer
sp = New SoundPlayer(My.Resources._error)
sp.Play()
Thanks a lot.
|
|
|
|
|
Of course that cannot work. Where does that code run? On the server. And how can you hear on your client what's played on the server? Only when client and server are the same computer.
You have to embed the sound in your web page, e.g. a tag for background sound, or embedding it.
|
|
|
|
|
1.- Where does that code run? The code is published in an IIS which any device conected on the local net enters (computers, tablets running Android)
2.- How can you hear on your client what's played on the server? I want to play a sound in each device that enters to the page
Right now a have embed the sound that i need to play on any device, in my web page, what I need to know is the right code to be able to play the sound when someone enters to the page
Thanks a lot
|
|
|
|
|
As Bernhard said, you can't play sound from server-side code and expect the user to hear it - unless they're all in the same room as your server and you turn the server's speakers up really loud!
You need to play the sound on the client. That means you'll need to have the sound in the correct format(s) for the browsers you need to support, and you'll need to use the HTML5 <audio> tag.
W3Schools has an article[^] explaining the process.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i new in asp.net i created asp.net dropdownlist , every time using mouse add click , when show all item, but focus dropdownlist show all itemlist
|
|
|
|
|
Member 2610211 wrote: every time using mouse add click , when show all item, but focus dropdownlist
show all itemlist
Are you trying to filter the dropdown list with the mouse click?
.AK.
|
|
|
|
|
Hi All,
Not really sure where to post this question but I hope someone here can help.
We have a classic asp site deployed in IIS7 under a domain, let's call it www.classicsite.com. We've developed a site in ASP.NET MVC and need to integrate it into the first site under the same domain so it'll be access as follows: www.classicsite.com/mvc.
What will the IIS setup be like?
Thanks.
Ronald
|
|
|
|