|
Thank you.
I cannt explain my problem more.
thank u for your answer.
|
|
|
|
|
This is my venture into the world of Web programming, so please be verbose in your answers.
I have a WinForms app which accesses a webservice which accesses a database and then returns some XML to the WinForms app.
I am currently in debug mode, and webservice is created OK. I get valid data back if I remove the database code from the equation.
My code to access the database in the webservice is:
<code>
//Connecting to Northwind database
string ConStr = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;";
SqlConnection myconnection = new SqlConnection(ConStr);
myconnection.Open();
SqlCommand mycommand = new SqlCommand("Select * from Customers", myconnection);
SqlDataReader dr = mycommand.ExecuteReader();
dr.Read();</code>
I receive an error: An error has occurred while establishing a connection to the server.
What steps do I need to take (in both the virtual and real server) for the webservice to see the database?
Regards
Andrew
|
|
|
|
|
In your connection string in the Data Source you have it set to localhost. That is not a valid sql server name. You need to put in the name of your sql server and make sure that your server that your web service is running on can resolve the sql server name to the correct IP address.
Hope that helps.
Ben
|
|
|
|
|
I have altered the Northwind file and added
"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SampleDatabases\NORTHWND.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True" as a connection string.
Error:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Unable to open the physical file "C:\SampleDatabases\NORTHWND.MDF". Operating system error 5: "5(error not found)".
An attempt to attach an auto-named database for file C:\SampleDatabases\NORTHWND.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Regards
Andrew
|
|
|
|
|
So it looks like the database file doesn't exist where it is expecting it. Or perhaps your web app doesn't have rights to read it. Normally you would put a sqlexpress file in the app_data folder of your web service. Then it should have access to it.
Ben
|
|
|
|
|
OK Thanks.
I tried another connection string and got a different error.
string ConStr =@"Server=localhost\SQLEXPRESS;database=databasename;Integrated Security=True";
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Cannot open database "ValuePro" requested by the login. The login failed.
Login failed for user 'USERNAME\ASPNET'.
Andrew
|
|
|
|
|
So you are using integrated security, which by default is aspnet user. You may need to change your connection string to use a set sqluser and sql password. If you still want to use integrated security, you will have to create a new application pool. Have your webservice user that app pool. Then you will have to create a new network user for the identity of the app pool. add that user to IIS_wpg group. Set the identity of the app pool to that user. Add that user to the sqlexpress database with the correct rights.
Ben
|
|
|
|
|
I am primarily an ASP .Net developer, but i have had some classic asp work come my way.
I am running into a problem with the submit funtion in forms. i have requiements for the following:
if the user checks a checkbox, then clicks save on one form, the page reloads, but the checkbox is no longer checked. hopw do i maintain the checked state of a checkbox? same for the selected items in a listbox control.
Also, some of the buttons on one form cause the page to submit, but it loads back at the top of the page. how does one modify the submit in the vb code to navigate to a named anchor (ie, page.asp#here)?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Vodstok wrote: hopw do i maintain the checked state of a checkbox
Render checked as the attribute of checkbox tag.
|
|
|
|
|
I'm looking for a good javascript compressor. Not specifically for obfuscation, but to ensure that the download payload is as small as possible.
Anyone using any they could recommend?
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Well, there's always this[^] one. I've had some success with it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Ah, excellent.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
|
There's JSMin[^] and Packer[^], both of which seem to be well used.
|
|
|
|
|
how to implement the Ajax in ASP.Net1.0,
is it possible? if possible pls send example to me
|
|
|
|
|
Read a book, read one of the many articles on CodeProject[^], search google or take a course.
But please don't post a question until you've tried finding some information yourself.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Hi,
i am using Form Authentication in my asp.net appication. It creates a persistent cookie named Cookie1 in cookies folder at my system. I want to change/set the Name of this cookie to Cookie2 on the click of a button from page.How can i do that ? (Q: Does form authentication always created persistent cookie, how can i change it so that when i close the browser , the coookie also goes off ?)
Alternatly, if i can create a new form authentication cookie at the same place with the name Cookie2. i am using following code.But cannot see my cookie2 in the folder
protected void LinkButton2_Click(object sender, EventArgs e)
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(30), true, FormsAuthentication.FormsCookiePath);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie authCookie = new HttpCookie("cookie2", encryptedTicket);
authCookie.Expires = System.DateTime.Now.AddMinutes(30);
authCookie.Secure = true;
Response.Cookies.Add(authCookie);
}
Any code support will be of great help.
Thx
|
|
|
|
|
Hi,
maybe this link can help you
Regards,
Tomi
|
|
|
|
|
hi,
im posting my requirements here,your suggestions are very much appreciated .
since im new to ajax tool kit im not much familiar about most of the controls,could anyone can suggest me to use appropriate controls for my query?
in my system i have nearly 100+ forms,and different categories of users.normally once new user is created,admin have to give access rights for the forms to new user.now the admin doing this by using a form which got list of all the forms in my projects witha check box,so admin have to manually check the appropriate name of the form for diff catagories of user and save it.
now the problem starts here,wen user create new forms then this access rights page need to be modified to add check control with new form name and data base need to modify to add new form name and access rights, how can i make it automatically,meaning once i create new form,the form related info must add to acceess right page with chk box, and also in data base
The Best performance for good work tomorrow is to do good work Today
|
|
|
|
|
tweety@net wrote: how can i make it automatically,meaning once i create new form,the form related info must add to acceess right page with chk box, and also in data base
You will need to maintain a table which would store the form names and load the access rights page with data from that table. Create a gridview or datagrid with a checkbox column, set the checked property of the checkbox based on the data from the user's access rights table.
|
|
|
|
|
I developed a web application, which has two sections
Client Section: that is visible to local users
Control Panel: allows admin of the site to control the contents of the web application.
I created a cpanel folder on the root of the web application, and all the pages and functionality of Control Panel section goes there. The sample structure of the files is as in below section:
/Default.aspx 'Client Side File
/contactUs.aspx 'Client Side File
/Aboutus.aspx 'Client Side File
/Web.config 'Main Configuration file ( admin section uses connectionstring from
'the same web.config file
/AppCode/DAL/Classes.vb ' Contains all the classes used in both client and cpanel section
/CPanel/Default.aspx ' Admin side File
/Cpanel/UpdateContactus.aspx ' Admin Side File
/Cpanel/UpdateAboutus.aspx ' Admin Side File
Now problem is that, i need to Secure Pages in CPANEL by adding Authenticating process, now if i add the authentication information in
/Web.Config /Main configuration file
then it will apply on both client side and Cpanel side as well... but i need this authentication only in CPanel side, so what i did is add a new configuration file with appropriate instructions and a Login Page, where person trying to open CPanel will be redirected if he/she has not logged in using proper username and password.
here i added those files at place
/CPanel/Web.Config
/CPanel/Login.aspx
but when i try to open any page, it gives me an error message
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS
---- The code for Web.config -----
<forms loginurl="Login.aspx" name="realestate" path="/" protection="All" timeout="30">
Any Solution?
1- Can we merge two different projects with different web.config files with each others?
:- Rashid Ali -:
|
|
|
|
|
Please don't cross post
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
All you need to do is select the folder in IIS manager and choose to make the subdirectory an Application by clicking the Create button down beside the application textbox.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi frndz,
In my company, we have an intranet, many didnt have acces to internet. But our server has the access to website. i want to have some contents of the internet to be available for my intranet users.
Is there any way i can do them.
Im thinking....
1. can we get website in the form of XML and from that can we again convert to web page.
2. can we scrap a portion of web page data and save as html file
anticipating ur answers....
Regards,
Bala | HeroITes | India
|
|
|
|
|