|
No, the GetResponse is not enough because I have data to write into the request. I don't know how to send data without the GetRequestStream.
|
|
|
|
|
Apologise, put my reading glasses on..
|
|
|
|
|
Sounds like a typical authentication challenge - the request doesn't send the credentials unless the server indicates that it needs to.
Try setting the PreAuthenticate property[^] to true :
req.Credentials = new NetworkCredential(...);
req.PreAuthenticate = true;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for your idea, but it doesn't work .
I have the same behavior : a 401 error followed by a 403.
|
|
|
|
|
I've just solved my problem. Le number of - characters was not good on the boundary line.
|
|
|
|
|
Hi experts ,
we are using this code to read xml file, we want to optimize the code .
Issue is that in our xml file around 50 attributes are there , but from that we want hardly 2 to 3 attributes value.
but here while loop is executing 50 times , that we don't want.
Please give suggestion .
Thanks
using (XmlReader reader = XmlReader.Create(@"C:\abc.xml"))
{
while (reader.Read() )
{
if (reader.IsStartElement("AccountNumber"))
{
listBox1.Items.Add(reader.ReadString());
}
else if ((reader.IsStartElement("AvailableDate")))
{
listBox1.Items.Add(reader.ReadString());
}
}
}
|
|
|
|
|
Rather than adding data to the ListBox directly inside your loop, add this data to a List<string>. Once you have exited the loop, use AddRange to add it to the ListBox.
This space for rent
|
|
|
|
|
Hello,
this might not be a real question, more like an interest about, how bad my current workaround is. I hope it's OK to post here .
I have an application which I have started developing for WPF and now I also want to port it to UWP. I have created some custom visual controls for the app in a Controls library, which is a Class Library in C# and references .Net WPF libraries.
Some custom panels would look very similar with code working in both frameworks, so I thought it would be nice to reuse my old code.
This is the solution I came up and currently porting the library to:
- left the original Controls class library project untouched
- created a Controls.UWP class library for UWP platform
- added source files from Controls to Controls.UWP as linked files
- finally - and currently working on - resolving the namespace changes by adding stuff like this at the beginning of source files:
#if WINDOWS_UWP
using Windows.Foundation;
#else
using System.Windows;
#endif
However, in some cases I must completely rewrite the class eg. because I used OnRender function to draw it, so now I have to rewrite it to use Win2D. For this reason I don't know if it's worth bother with #if statements.
What do you think, is this a bad idea?
|
|
|
|
|
How I would tend to do this is put common code inside a PCL which can be used by both sides. Then all you have to do is write your platform specific code and call the shared functionality.
This space for rent
|
|
|
|
|
Thank you for the reply! Then I guess, I wanted to create a monster with platform specific code (the UI controls) for two frameworks in common source files.
I have already used PCL, that's why I thought it would be nice to have something similar for UI, too.
Also, since my post I found other issues, like the missing FrameworkPropertyMetadata from UWP and more restricted attached property accessors. So, it seems, that I couldn't save anyway as much code-rewriting as I wanted .
|
|
|
|
|
The biggest problem you will face is that, despite appearances, WPF and UWA are two vastly different beasts. Universal Windows programs are a lot closer to Silverlight, so there are things that you can do in WPF that just aren't available in WPF (and vice versa). This would have a fundamental impact on things such as what your XAML does, which would be a major pain to work around.
This space for rent
|
|
|
|
|
Wrong post.Deleted.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Please do not repost, especially with just a link to the other forum.
|
|
|
|
|
Ok, I will remove it.
[Edit]
BTW neither the comment nor the downvote helped me to solve the Problem. Next time don't mark something like that as an answer
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Morning all.
Using C# is there a way to set the "Maximum Worker Processes" value in IIS?
<a href="http://i.imgur.com/xvfaJP6.png">
Currently we set this value manually in each server and it would be productive to be automated.
Thanks,
|
|
|
|
|
If you reference Microsoft.Web.Administration in your project, look at the ApplicationPoolProcessModel.MaxProcess property.
This space for rent
|
|
|
|
|
I wish u solve this problem
|
|
|
|
|
|
It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
So either pay someone to do it, or learn how to write it yourself. We aren't here to do it for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I'm new here wish you solve my problem
need to make my application performance better than saving it in database
|
|
|
|
|
|
I am trying to run the task in a child thread, but I'm not able to get notification when a child thread complete its task.
|
|
|
|
|
|
The simplest way to do this is via a BackgroundWorker: BackgroundWorker Class (System.ComponentModel)[^] - it provides events to indicate progress and completion which makes it very simple to use.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I am new to the .NET environment and trying to write a simple MVC application to read student data and display it to the end user. I have connected to a database using SQLOLEDB, the code of which I have pasted below. The data obtained from the query was stored in a variable of the type DataTable. Now I want to see the content of the query result in the form of a JSON output for which I have a faintest idea that I have to create a new controller. But I am not able to proceed beyond this point.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
namespace Database.model
{
public class student
{
public int id { get; set; }
public string name { get; set; }
private string age { get; set; }
public DataTable GETSQLServerData()
{
var _connectionobject = new SqlConnection();
_connectionobject.ConnectionString = @"Provider=SQLOLEDB;Data Source=PHYSICS\SQLEXPRESS;Persist Security Info=true;Initial Catalog=master;Integrated Security=True; provider = SQLOLEDB;";
_connectionobject.Open();
var _commandObject = new SqlCommand();
_commandObject.CommandText = "select * from dbo.tblStudent";
_commandObject.ExecuteReader();
var _dataReader = _commandObject.ExecuteReader();
DataTable obj2 = new DataTable();
obj2.Load(_dataReader);
_connectionobject.Close();
return obj2;
}
}}
With Regards
Nikhilesh Murty
|
|
|
|