Concern Support
asked on
How to login to a domain server as admin using vb.net
Dear Experts,
I have developed an application which is storing ID,Name,FirstName,Photo of an employee, In the Photo field i am storing the address of the picture which is e.g 192.168.0.1/Db files/pic1.jpg.
Db files is a shared folder in Domain Server to which only the domain admin account has the access. the problem is, when i login from a client computer as admin then i can store,see,delete and update employee pictures on the server. However when other user without admin power logsin then they can't access db files.
my connection string is
myCon= New SqlConnection("Data Source=192.168.0.1;Initial Catalog=abc;User ID=sa;Password=123")
i have a solution but i don't want that, if you give access permission on db files to every one then it is ok, but i don't want that, because irresponsible user then can logs in and can make changes.
Could you tell me that solution or another alternative.
I have developed an application which is storing ID,Name,FirstName,Photo of an employee, In the Photo field i am storing the address of the picture which is e.g 192.168.0.1/Db files/pic1.jpg.
Db files is a shared folder in Domain Server to which only the domain admin account has the access. the problem is, when i login from a client computer as admin then i can store,see,delete and update employee pictures on the server. However when other user without admin power logsin then they can't access db files.
my connection string is
myCon= New SqlConnection("Data Source=192.168.0.1;Initial
i have a solution but i don't want that, if you give access permission on db files to every one then it is ok, but i don't want that, because irresponsible user then can logs in and can make changes.
Could you tell me that solution or another alternative.
ASKER
i don' have any idia. this is my code which copy the picture to the server.
Where to use the procedure
Where to use the procedure
Private Sub CopyPic()
Try
Dim fname, serverpath, CodeNumber As String
Dim i As Integer
fname = oOpenFileDialog.FileName()
If fname <> "" Then
i = fname.LastIndexOf("\")
substring = fname.Substring(i + 1)
Directory.CreateDirectory("192.168.0.1\Db files\Picture")
File.Copy(fname,"192.168.0.1\Db files\Picture" & substring)
oOpenFileDialog.Reset()
Else
End If
Catch ex As Exception
GiveError(ex)
End Try
Ok, what I meant is encapsulate all the code used to store images into the share folder using T-SQL code into a procedure and use WITH EXECUTE_AS clause as suggested earlier.
Seems like you are trying everything using VB scripts.
Seems like you are trying everything using VB scripts.
ASKER
Yes, i am doing it using vb scripts.
But i don't have any idea of Execute_AS procedure.
Can you do that code for me using procedure.
But i don't have any idea of Execute_AS procedure.
Can you do that code for me using procedure.
Using T-SQL script to insert images into SQL Server:
http://blog.sqlauthority.com/2009/03/06/sqlauthority-news-author-visit-toronto-canada-insert-image-in-database/
Retrieve images from SQL Server:
http://madhuottapalam.blogspot.com/2008/08/creating-files-from-images-stored-in.html
http://blog.sqlauthority.com/2009/03/06/sqlauthority-news-author-visit-toronto-canada-insert-image-in-database/
Retrieve images from SQL Server:
http://madhuottapalam.blogspot.com/2008/08/creating-files-from-images-stored-in.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes CodeCruiser i have the same logic, but let me readout the link
ASKER
Great
Grant permissions on the procedure only to the required users.