I am doing an AJAX call back to a WebMethod but in the code behind webmethod I cannot use any of the constants at the to of my form. What I want is to gain access to sessions and my sql connection string.
I have a code behind page that has several method; one of them is a page method.
[WebMethod] public static void ResetDate(DateTime TheNewDate) { LoadCallHistory(TheNewDate.Date); } protected void LoadCallHistory(DateTime TheDate) { bunch of stuff }
The method LoadCallHistory works fine when the page loads and I can call it from other methods inside the page. However, in the web method part, it gets underlined in red with the error "an object reference is required for the non-static field".
How do you access functions from the page method part of the code?
string mysqlsPath = Server.MapPath("applog.txt"); command.CommandText = "LOAD DATA LOCAL INFILE '" + mysqlsPath + "' INTO TABLE numbers FIELDS TERMINATED BY ',' LINES TERMINATED BY ' '"; command.ExecuteNonQuery(); connection.Close();
I get Error LOAD DATA LOCAL INFILE ---> Could not find file 'c:windowssystem32inetsrvinetpubwwwrootwebservicesapplog.txt'
When looking at this error i noticed that after "inet"its dropping the "" between the rest of the directories,what could be causing this and how can I fix it?
I have 2 web pages edit.aspx and webmethods.apx. In edit.aspx there is some jquery code to get some data :
[Code]....
With this I try to get a Json object from the webmethods.aspx page :
[Code]....
I get an error back that says "Parser Error", I even did put an breakpoint on the webmethod but it is like it's never triggered. Is my url wrong if I'm in the following url :
I am using the following Web method.. its work fast on local host , but on Domain hosted server .. its works odd , i;e; some time its work fast about (1-3 sec) and some take about 10-14 sec to process.. Â how do i make it work properly and fast.. Â here is my codeÂ
[WebMethod] public static string DisplayMessage(string name, string price,string obj, string id) { SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["eshopConnectionString"].ConnectionString); //Creating Delay""
Aplogies if this has been discussed before but I couldn't find an answer.
I'm trying to use jquery/Ajax to access some webmethods in my codebehind. This is fine, but I would in my function like to reference a placeholder (phStory in the code below) on my page and also load a usercontrol into that placeholder.
Unfortunately I get the message: "An object reference is required for the non-static field, method, or property 'TestControls.phStory' " and similar for the usercontrol. Does anyone know how I can still access my placeholder and usercontrol from within this.
It has to be stati as it's a WebMethod but this then throws up these errors.
I have a WebMethod that is inside of an ASP.NET Web Service application. I use a Try Catch block inside the WebMethod. If an exception is thrown and I want to see the ex.Message is there a way to use a messsagebox? Maybe there is some Imports statement that can be used so you can use a messagebox inside an ASP.NET Web Service application. I could declare a string for use to display the ex.Message but then the WebMethod would have to return that string somehow. That's something I don't know how to do. As long as no exceptions are thrown I'm ok but if an exception is thrown it's good to know what it is. The ASP.NET Web Service application is using .NET Framework 2.0.
In another thread gep13 was talking about creating a class so that you could return more than one thing from a WebMethod and if that's what I have to do that's fine but if there's a simpler way to see the ex.Message then that's ok too.
I was interested in creating a WebMethod that could send an email. I would prefer to use Visual Basic instead of C# since I know Visual Basic much better.
I am attempting to write an assembly that is hosted by a Web page on IIS. Everything works until I try to read a file from the file system, when I get the following error:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; GTB6.4; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30729) Timestamp: Tue, 11 May 2010 20:10:22 UTC Message: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
So...I tried the example program found here, which has a similar use:
I compiled and published the application, but all I get is a page with a big rectangle and a little icon in the upper left corner, with no error messages. This is the same behavior I get in my own application when I give it a strong name key. (Without the strong name key, it runs properly, but gets the exception above.)
i have a .JPG file in my local machine which has to be sent as body of SMTP mail.Path of image D://foldername//imagename.jpg The code I run is in the server mc. I want it to access my local machine's d: folder to get the image file. But it is accessing the server mc's d: folder. How can this be done?
I started working on an ASP.NET web app for my companies local intranet. While coding it, I emailed our IT team, to get an intranet domain/server setup.
So, they emailed me back with the server credentials+the domain. But, I'm not really sure what to do from here.
How I need to setup the server and ASP.NET settings to get everything working?
it may not have to do with silverlight as such, but a "security" issue. I appologize if that was wrong.
I´m having a go at silverlight...
I want to display large amount of data in good looking charts. Ideally, I would use a web service. However none of the tutorials I´ve watched works. There´s always some component or class missing.
So I figured I´d do it the "ugly" way, creating a xml file from a dataset, and then reading it in the silverlight app.
Now when debugging, I use a local file, which is apparently not permitted
I've just downloaded VS2010 Express to play with on my personal laptop. However, when I try to open an existing website through the "Open Web Site..." / "Local IIS" button, the system trundles on for a bit and then says: "To access local IIS Web sites, you must install the following IIS components: In addition, you must run Visual Studio in teh context of an administrator account."
Note the blank line after the "you must install...." [strikeout]Is this a limitation of the "Express" editions of Visual Studio? [/strikeout] I've just installed VS2010 Premium from our MSDN DVD and it has the same problem.... Also, seems to have broken VS2008 as well since I can no longer browse Local IIS from VS 2008 either. Good thing I installed this on my backup machine first and I can still get work done on my main development machine!
I have an ASP.NET page that I need to have access the local file system. It's an intranet. I need to download a zip file and an executable to a temp location and then run the executable.
Then afterwards, I need to delete the contents via an ASP.NET page.
Is there any way to access the local file system? Generally, I would think this would cause a security concern, but I've seen posts about Silverlight being able to access it.
I have a service that works great on my development box. It uses JQuery to hit my web service, and then the JSON results are sent back.
The web service is located on our basePage.cs. We didn't want to put out an external WebService for this. Our on beta box something different is happening.
The web page seems to be trying to call the web method correctly - the JSON data is being sent... but the server doesn't seem to know it's a webmethod. here's my service function (it's in our basepage.cs which inherits from Page).
I'm sort of new to developing Asp.net webapplication projects while running them on a local IIS. Till now I used the 'Use Visual Studio Development Server' option.
I'm using Visual Studio 2010 Beta 2.
Edit: less complex sample code
Following code sample:
List<string> _list = new List<string>(); _list.Add("asd"); _list.Add("asd2"); _list.Add("asd3");
Now I want to debug / step through some line of codes with _list. While using 'Use Visual Studio Development Server' I can see the contents of _list in the quick watch. If I select 'Use Local IIS Web server' and debug through the same piece of code, the quickwatch tries to display me the same values by showing me a spinning wheel for about 10 seconds with a resulting 'Function evalutation disabeld because a previous function evalution timed out. You must continue execution to reenable function evalution' message.
Afterwards I get a windows error dialog with 'Unhandeld win32 exception occured in w3wp.exe [844] The Just-In Time debugger was launched without necessary security permission..'
I do run Visual Studio 2010 Beta 2 as Administrator. I start debugging by pressing F5. It seems that I can't really debug this way. Do I somehow have to attach the VS debuggerto the IIS process? If yes, how to do so?
What am I doing wrong, and how to solve it?
And by the way, is that erroneous behaviour new in VS 2010? I've never expierencied that in VS 2008.
Why when I generate local resource does it check out the web.config. I've done a comparison after the process has completed and the web.config hasnt changed.I'm using TFS 2010 Basic.It's not a big issue but I would be interested if anyone knows the answer.
When the user hits the Save button, AddSaveChanges_Click() is called. In that procedure, I want to make sure the user has entered a valid email in txbPrinterEmailAddress. The problem is when I reference RegExEmailValidator in my code behind, I get object reference not set to an instance. This is my code when I detect the invalid email
Code:
Else Logwriter.LoggerWrite(String.Format("Page is NOT valid and {0} is an invalid email id", txbPrinterEmailAddress.Text), "MyLog") 'EditPanel.Visible = True 'ShowListPanel.Visible = False 'AddPanel.Visible = False RegExEmailValidator.Enabled = True RegExEmailValidator.Validate() End If
And my log entries are:
11/22/2011 1:40:37 PM Page is NOT valid and xxxxxx is an invalid email id
11/22/2011 1:40:37 PM EXCEPTION in AddSaveChanges_Click() - Object reference not set to an instance of an object.Why is RegExEmailValidator not an instantiated object?
I have a few pages in my web application where I would like to be able to use the code-behind of a master file, but not 'inherit' any of the other stuff like asp/html markup etc.
I would like to access an Excel 2010 spreadsheet via ASP.NET 4 - what is the best (i.e. straight forward) method to do this? I would like to update the spreadsheet via ASP then read the results of the data from Excel back to a web form.
I'm changing the CSS of my menu items during runtime to reflect which page is currently being viewed. It works fine. But, I have a nested master page that needs to change the CSS of the master page's items. How I can access the master page's menu items?
I wonder what is the best place to store the enums I should use like constants in my n-tiers Application.
So I have an application with a DAL(connect to database), a BLL(Business processes), a Data Transfert object "Layer" (classes without any methods but just fields, this one is reacheable by all the others) and the interface layer with the asp pages.
My question is : I have a enum:
[code]....
Where can I put this enum(and all the others) to be clean? Not in the Data Access Layer the Interface layer will not see the struct, not in the Business Logic Layer, this is not really business.. Maybe in the Data Transfert Object but is it really a "Transfert object"?
Is such an architecture possible? What datatypes can we use? I only exemplified enums because this is what i use right now, but they must be declared in the same file as they are used.