Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Saturday, March 31, 2012

String to equation

Got a quick question that I cannot get to work at work!

I have a field in SQL server that is set as a varchar but contains data like
>50 or <2 which is actually a target percentage. I have data in another
table stored as Decimal(14,2) that is the actual percentage. I need to
extract the two and create a conditional formatting result in a datalist.

Basically it would be something like this.

Assume actualpercentage = 30
targetpercentage = >50

If actual percentagetargetpercentage = True then forecolor= "Green"
Else
forecolor = "Red"

In actual terms it would be like
If 30>50 = True then forecolor = "Green"
Else
forecolor = "Red"

Don't worry about setting the color I can get that accomplished if I could
just build the boolean expression. And trust me I know the way it is written
here seems weird but it represents what I need to test. Basically the target
percentage is anything above 50% so I need to test and see if the actual was
greater than the target. However, like I show before the target could be
anything like <2%

Thanks for any help, a function or any mechanism for that matter would be
great.

Marty UHi Mary,

Obviously the first thing to do is to parse your varchar field. You stated
that your column "contains data like >50 or <2" - you need to get more
specific than that, becuase in essence, you have stored 2 different things
in the column, and the first thing you need is to split your string into 2
pieces. The only way to do that is to know what all of the possible values
for the first (comparison operator) is, so that you can identify where
tosplit the data. Of course, this would have been much easier if you had
used 2 columns to store the 2 values; that is good database design. But once
you've identified all the possible values of the first part, you can create
a loop that loops through all of them and uses the index of the last
character to determine where to split the value. Once split into 2 values,
you need to create a loop which selects from various kinds of comparison
operators that correspond to the ones in your list of possibles, and builds
a comparison statement from one of them.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Marty Underwood" <martman100@.insightbb.com> wrote in message
news:bczYb.341294$xy6.1700666@.attbi_s02...
> Got a quick question that I cannot get to work at work!
> I have a field in SQL server that is set as a varchar but contains data
like
> >50 or <2 which is actually a target percentage. I have data in another
> table stored as Decimal(14,2) that is the actual percentage. I need to
> extract the two and create a conditional formatting result in a datalist.
> Basically it would be something like this.
> Assume actualpercentage = 30
> targetpercentage = >50
> If actual percentagetargetpercentage = True then forecolor= "Green"
> Else
> forecolor = "Red"
> In actual terms it would be like
> If 30>50 = True then forecolor = "Green"
> Else
> forecolor = "Red"
>
> Don't worry about setting the color I can get that accomplished if I could
> just build the boolean expression. And trust me I know the way it is
written
> here seems weird but it represents what I need to test. Basically the
target
> percentage is anything above 50% so I need to test and see if the actual
was
> greater than the target. However, like I show before the target could be
> anything like <2%
> Thanks for any help, a function or any mechanism for that matter would be
> great.
> Marty U
>
Hi Marty,

Look at the String.Substring() method. It's overloaded. One version takes
one parameter, which is the starting index of the substring. It reads to the
end of the string. The other takes a second parameter which is the number of
characters to get. So, assuming that your data, as you said, has only 2
single-character comparison operators, you can get the 2 values from it by
using the String.Substring method(). Example:

Dim s As String = "<123"
Dim operator As String = s.Substring(0, 1)
Dim value As Integer = Convert.ToInt32(s.Substring(1))

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Marty U" <anonymous@.discussions.microsoft.com> wrote in message
news:8ABD3BD8-4FD3-456D-8DA0-722D75DCD452@.microsoft.com...
> Thanks for the reply Kevin,
> The only two comparison operators would be the greater than, less than
operators. I would have split these into two different columns but the
customer never said they would be used for actual comparisons but just a
display mechanism. Now I don't have time to redesign the related objects
that would use the split column.
> I had an idea of creating a function that receives 3 items.
> Function ShowResult(ActualValue as Decimal, theOperator as String,
TargetValue as Decimal)
> Dim theResult as Boolean
> theResult = ActualValuetheOperatorTargetValue
> Select Case theResult
> Case "True"
> do something
> Case "False"
> do something
> End Select
> End Function
> I would use a Left(TargetValue, 1) to pass theOperator argument. Can you
look at this theory and give me an idea how I can pass these 3 items into a
function and get the desired result of whether it's true or false.
> Thanks again, I don't have time to harp on this since I have a deadline of
Friday and this is just a perk they would like to have.
Sounds good I will look into this tomorrow at work. Oh and by the way I did
split the column into two seperate columns today due to another issue I had
that was not worth the trouble. It was easier to modify six pages of code
and modify the database then to program with the data being combined in the
DB.

Marty U

"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:e2rCPxk9DHA.452@.TK2MSFTNGP11.phx.gbl...
> Hi Marty,
> Look at the String.Substring() method. It's overloaded. One version takes
> one parameter, which is the starting index of the substring. It reads to
the
> end of the string. The other takes a second parameter which is the number
of
> characters to get. So, assuming that your data, as you said, has only 2
> single-character comparison operators, you can get the 2 values from it by
> using the String.Substring method(). Example:
> Dim s As String = "<123"
> Dim operator As String = s.Substring(0, 1)
> Dim value As Integer = Convert.ToInt32(s.Substring(1))
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
> "Marty U" <anonymous@.discussions.microsoft.com> wrote in message
> news:8ABD3BD8-4FD3-456D-8DA0-722D75DCD452@.microsoft.com...
> > Thanks for the reply Kevin,
> > The only two comparison operators would be the greater than, less than
> operators. I would have split these into two different columns but the
> customer never said they would be used for actual comparisons but just a
> display mechanism. Now I don't have time to redesign the related objects
> that would use the split column.
> > I had an idea of creating a function that receives 3 items.
> > Function ShowResult(ActualValue as Decimal, theOperator as String,
> TargetValue as Decimal)
> > Dim theResult as Boolean
> > theResult = ActualValuetheOperatorTargetValue
> > Select Case theResult
> > Case "True"
> > do something
> > Case "False"
> > do something
> > End Select
> > End Function
> > I would use a Left(TargetValue, 1) to pass theOperator argument. Can you
> look at this theory and give me an idea how I can pass these 3 items into
a
> function and get the desired result of whether it's true or false.
> > Thanks again, I don't have time to harp on this since I have a deadline
of
> Friday and this is just a perk they would like to have.

String was not recognized as a valid DateTime

I am getting the following error:

Server Error in '/Web' Application.

String was not recognized as a valid DateTime.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.FormatException: String was not recognized as a valid DateTime.

Source Error:

Line 103: decimal Reorderlevel = decimal.Parse(row["P_ReorderLevel"].ToString());Line 104: string Warehouseno = row["P_WareHouseNo"].ToString();Line 105: DateTime Modifieddate = DateTime.Parse(row["P_ModifiedDate"].ToString());Line 106: string Memo = row["P_Memo"].ToString();Line 107: string Desc = row["P_Desc"].ToString();


Source File:C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs Line:105

Stack Trace:

[FormatException: String was not recognized as a valid DateTime.] System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2271362 System.DateTime.Parse(String s) +22 WareHouse.DataLayer.DataObjects.SqlServer.SqlServerProductDao.GetProduct(Int32 ProductID) in C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs:105 WareHouse.BusinessLayer.Facade.ProductFacade.GetProduct(Int32 ProductID) in C:\IList_WareHouse_Solution\Facade\ProductFacade.cs:104[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +358 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +17 System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +676 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2660 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +84 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99 System.Web.UI.WebControls.DetailsView.DataBind() +23 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +91 System.Web.UI.WebControls.DetailsView.EnsureDataBound() +196 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +101 System.Web.UI.Control.EnsureChildControls() +134 System.Web.UI.Control.PreRenderRecursiveInternal() +109 System.Web.UI.Control.PreRenderRecursiveInternal() +233 System.Web.UI.Control.PreRenderRecursiveInternal() +233 System.Web.UI.Control.PreRenderRecursiveInternal() +233 System.Web.UI.Control.PreRenderRecursiveInternal() +233 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4436

whenever I run

//get single product

publicProduct GetProduct(int ProductID)

{

StringBuilder sql =newStringBuilder();

sql.Append("usp_SelectProduct");

SqlParameter[] p =newSqlParameter[1];

p[0] =newSqlParameter("@dotnet.itags.org.P_Productid",SqlDbType.Int);

p[0].Value = ProductID;

DataRow row =Db.GetDataRow(sql.ToString(), p);

int productid =int.Parse(row["P_ProductID"].ToString());

string Productname = row["P_ProductName"].ToString();

decimal Qtyperunit =decimal.Parse(row["P_QtyPerUnit"].ToString());

decimal Unitprice =decimal.Parse(row["P_UnitPrice"].ToString());

decimal Unitsinstock =decimal.Parse(row["P_UnitsInStock"].ToString());

decimal Unitsonorder =decimal.Parse(row["P_UnitsOnOrder"].ToString());

decimal Reorderlevel =decimal.Parse(row["P_ReorderLevel"].ToString());

string Warehouseno = row["P_WareHouseNo"].ToString();

DateTime Modifieddate =DateTime.Parse(row["P_ModifiedDate"].ToString());

string Memo = row["P_Memo"].ToString();

string Desc = row["P_Desc"].ToString();

Product product;

return product =newProduct(productid, Productname, Qtyperunit, Unitprice, Unitsinstock, Unitsonorder, Reorderlevel, Warehouseno, Modifieddate, Memo, Desc);

}

Is there a problem in the way that I am converting my DateTime to string?

thanks

Nick

what is the data type of this:P_ModifiedDate
if it is a datetime, then you dont need to convert it to a string at all

try:

DateTime Modifieddate =Convert.ToDateTime(row["P_ModifiedDate"])


As the other poster said, if p_ModifiedDate is of type DateTime you don't need to user DateTime.Parse, neither convert it to string.

If it's in a string, then you don't need the .ToString method, however, the date has to be in the format appropriate to your thread's culture.

eg, if it's en-US it should be mm/dd/yyyy.


Ok, so DateTime is I guess a string type? I tried the

DateTime Modifieddate =Convert.ToDateTime(row["P_ModifiedDate"]);

and it generated another error saying:

Server Error in '/Web' Application.

Object cannot be cast from DBNull to other types.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:

Line 103: decimal Reorderlevel = decimal.Parse(row["P_ReorderLevel"].ToString());Line 104: string Warehouseno = row["P_WareHouseNo"].ToString();Line 105: DateTime Modifieddate = Convert.ToDateTime(row["P_ModifiedDate"]);Line 106: string Memo = row["P_Memo"].ToString();Line 107: string Desc = row["P_Desc"].ToString();


Source File:C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs Line:105

this is what my product.cs class looks like:

namespace WareHouse.BusinessLayer.BusinessObjects

{

[Serializable]

publicclassProduct

{

/**** FIELD PRIVATE ****************************************/

privateint _ProductID;

privatestring _ProductName;

privatedecimal _QtyPerUnit;

privatedecimal _UnitPrice;

privatedecimal _UnitsInStock;

privatedecimal _UnitsOnOrder;

privatedecimal _ReOrderLevel;

privatestring _WareHouseNo;

privateDateTime _ModifiedDate;

privatestring _Memo;

privatestring _Desc;

// overload with 10 arguemtns for SqlServerProductDao

public Product(int P_ProductID,string P_ProductName,decimal P_QtyPerUnit,decimal P_UnitPrice,decimal P_UnitsInStock,decimal P_UnitsOnOrder,decimal P_ReorderLevel,string P_WareHouseNo,DateTime P_ModifiedDate,string P_Memo,string P_Desc)

{

this._ProductID = P_ProductID;

this._ProductName = P_ProductName;

this._QtyPerUnit = P_QtyPerUnit;

this._UnitPrice = P_UnitPrice;

this._UnitsInStock = P_UnitsInStock;

this._UnitsOnOrder = P_UnitsOnOrder;

this._ReOrderLevel = P_ReorderLevel;

this._WareHouseNo = P_WareHouseNo;

this._ModifiedDate = P_ModifiedDate;

this._Memo = P_Memo;

this._Desc = P_Desc;

}

...

....

publicDateTime ModifiedDate

{

get

{

return _ModifiedDate;

}

set

{

_ModifiedDate =value;

}

}


Ok, so DateTime is I guess a string type? I tried the

DateTime Modifieddate =Convert.ToDateTime(row["P_ModifiedDate"]);

and it generated another error saying:

Server Error in '/Web' Application.

Object cannot be cast from DBNull to other types.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:

Line 103: decimal Reorderlevel = decimal.Parse(row["P_ReorderLevel"].ToString());Line 104: string Warehouseno = row["P_WareHouseNo"].ToString();Line 105: DateTime Modifieddate = Convert.ToDateTime(row["P_ModifiedDate"]);Line 106: string Memo = row["P_Memo"].ToString();Line 107: string Desc = row["P_Desc"].ToString();


Source File:C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs Line:105

this is what my product.cs class looks like:

namespace WareHouse.BusinessLayer.BusinessObjects

{

[Serializable]

publicclassProduct

{

/**** FIELD PRIVATE ****************************************/

privateint _ProductID;

privatestring _ProductName;

privatedecimal _QtyPerUnit;

privatedecimal _UnitPrice;

privatedecimal _UnitsInStock;

privatedecimal _UnitsOnOrder;

privatedecimal _ReOrderLevel;

privatestring _WareHouseNo;

privateDateTime _ModifiedDate;

privatestring _Memo;

privatestring _Desc;

// overload with 10 arguemtns for SqlServerProductDao

public Product(int P_ProductID,string P_ProductName,decimal P_QtyPerUnit,decimal P_UnitPrice,decimal P_UnitsInStock,decimal P_UnitsOnOrder,decimal P_ReorderLevel,string P_WareHouseNo,DateTime P_ModifiedDate,string P_Memo,string P_Desc)

{

this._ProductID = P_ProductID;

this._ProductName = P_ProductName;

this._QtyPerUnit = P_QtyPerUnit;

this._UnitPrice = P_UnitPrice;

this._UnitsInStock = P_UnitsInStock;

this._UnitsOnOrder = P_UnitsOnOrder;

this._ReOrderLevel = P_ReorderLevel;

this._WareHouseNo = P_WareHouseNo;

this._ModifiedDate = P_ModifiedDate;

this._Memo = P_Memo;

this._Desc = P_Desc;

}

...

....

publicDateTime ModifiedDate

{

get

{

return _ModifiedDate;

}

set

{

_ModifiedDate =value;

}

}


The date you fetch from DB might be null, Try this:

DateTime Modifieddate;object Modifieddate_obj = row["P_ModifiedDate"];if(Modifieddate!= System.DBNull.Value){ Modifieddate = Convert.ToDateTime();}


I tried the following:

DateTime Modifieddate;object Modifieddate_obj = row["P_ModifiedDate"];if(Modifieddate!= System.DBNull.Value){ Modifieddate = Convert.ToDateTime();}

and got errors saying:

Error 11 Operator '!=' cannot be applied to operands of type 'System.DateTime' and 'System.DBNull' C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs 107 17 DataObjects
Error 12 No overload for method 'ToDateTime' takes '0' arguments C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs 109 32 DataObjects

Next I tried:

object Modifieddate_obj = row["P_ModifiedDate"];
if (Modifieddate_obj != System.DBNull.Value)
{
Modifieddate = Convert.ToDateTime();
}

and I still got errors saying:

Error 11 No overload for method 'ToDateTime' takes '0' arguments C:\IList_WareHouse_Solution\DataObjects\SqlServer\SqlServerProductDao.cs 109 32 DataObjects

thanks

nick


Make sure you are getting some value in P_ModifiedDate and it is in the correct date format. If so, then you can convert it to your needs. And also Convert.ToDateTime takes a parameter, it should be used like this : Modifieddate = Convert.ToDateTime(Modifieddate_obj);

Thanks

String was not recognized as a valid DateTime

I moved some projects to another server and using the code below i get
the error:-
"String was not recognized as a valid DateTime"
<asp:Label runat="server" width="40%" text='
<%#
DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).ToSh
ortDateString()%>' id="Label6">
*** Sent via Developersdex http://www.examnotes.net ***Well folks...
I added:-
culture="en-US"
to the globalization in Web.Config and did the trick
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
/>
*** Sent via Developersdex http://www.examnotes.net ***
Hi Patrick,
If you just use DataBinder.Eval(Container,"DataItem.dt").ToString() is
anything displayed?
If it is, I would be checking that the date format matches your Regional
Settings (System Account). If you are using SQL I��d also be checking that
the collation of the new server/database is the same as your old one.
Brad.
"Patrick Olurotimi Ige" wrote:

> I moved some projects to another server and using the code below i get
> the error:-
> "String was not recognized as a valid DateTime"
> <asp:Label runat="server" width="40%" text='
> <%#
> DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).ToSh
> ortDateString()%>' id="Label6">
>
> *** Sent via Developersdex http://www.examnotes.net ***
>
> <asp:Label runat="server" width="40%" text='
> <%#
> DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).To
> Sh
> ortDateString()%>' id="Label6">
Why don't you just do this instead:
<%# ((DateTime)DataBinder.Eval(Container.DataItem, "dt")).ToShortDateString(
)
%>
-Brock
DevelopMentor
http://staff.develop.com/ballen

Wednesday, March 28, 2012

String was not recognized as a valid DateTime

I moved some projects to another server and using the code below i get
the error:-

"String was not recognized as a valid DateTime"

<asp:Label runat="server" width="40%" text='
<%#
DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).ToSh
ortDateString()%>' id="Label6"
*** Sent via Developersdex http://www.developersdex.com ***Well folks...
I added:-
culture="en-US"
to the globalization in Web.Config and did the trick

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
/
*** Sent via Developersdex http://www.developersdex.com ***
Hi Patrick,

If you just use DataBinder.Eval(Container,"DataItem.dt").ToString() is
anything displayed?

If it is, I would be checking that the date format matches your Regional
Settings (System Account). If you are using SQL I'd also be checking that
the collation of the new server/database is the same as your old one.

Brad.

"Patrick Olurotimi Ige" wrote:

> I moved some projects to another server and using the code below i get
> the error:-
> "String was not recognized as a valid DateTime"
> <asp:Label runat="server" width="40%" text='
> <%#
> DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).ToSh
> ortDateString()%>' id="Label6">
>
> *** Sent via Developersdex http://www.developersdex.com ***
> <asp:Label runat="server" width="40%" text='
> <%#
> DateTime.Parse(DataBinder.Eval(Container,"DataItem.dt").ToString()).To
> Sh
> ortDateString()%>' id="Label6"
Why don't you just do this instead:

<%# ((DateTime)DataBinder.Eval(Container.DataItem, "dt")).ToShortDateString()
%
-Brock
DevelopMentor
http://staff.develop.com/ballen

String was not recognized as a valid DateTime in another server

Hi guys,

I am currently facing this problem for quite some time now.

This is my codes below :

--------------------

Dim dateBetweenAsString = txtDateBetween.Text.ToString.Trim

Dim dateToAsString = txtDateTo.Text.ToString.Trim

'stored procedure is done here<blah><blah>

.Parameters.AddWithValue("@dotnet.itags.org.DateBetween", DateTime.Parse(dateBetween))

.Parameters.AddWithValue("@dotnet.itags.org.DateTo", DateTime.Parse(dateTo))

-------------------

Everything was working perfectly on my comptuer but when I tried on another server, it prompts me "String was not recognized as a valid DateTime"

I've tried conversion on both sql and asp.net but to no avail. Can someone please help?

Ryan.

Hi Ryan,

Based on my understanding, your asp.net application works fine on your local. But you get the error message above on another server when the application tries to convert the string to DateTime. If I have misunderstood you, please feel free to let me know.

Firstly, please make sure that the DateTime format matchs the DateTime format on the server.

If the formats are different, please try to use CurrentCulture's DateTimeFormat property. For example:
DateTime dt = DateTime.Parse(dateBetween, System.Threading.Tread.CurrentThread.CurrentCulture.DateTimeFormat);

Besides, you can get more information from theStandard DateTime Format Strings.

I hope this helps.


hi Hyde,
why are u usingDim dateBetweenAsString = txtDateBetween.Text.ToString.Trim

Dim dateToAsString = txtDateTo.Text.ToString.Trim, string to declare and pass as datatime,

I think you should declare both variables as datatime, and use datatimefunction to add, subtract, format or less than or greater than function provided by Thomas.

Cheers>
Dinesh.

String was not recognized as a valid DateTime.

hi,

i just uploaded my web application to a remote server, everything works fine on my local machine..

but i m getting this error message on my remote server .. that is perhaps on the remote pc the sql server is handling datetime in a different format... how to check it and how can i set it up same as my local sql server date time format? or is there any other solution to it ?

String was not recognized as a valid DateTime.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.FormatException: String was not recognized as a valid DateTime.

in the database... column type is date time and and even this simple query is generating this error..

dim str as sqldatetime = sqldatetime.parse("Select 'datecolumn' from table")

thanks

Ok wich version of SQL server do u have on your pc and on your server?

That error might appear when you type a string in a wrong way

acepted formats in SQL SERVER EXPRESS 2005

01/01/2006

1/1/2006

1/1/06

1/01/06

1/01/2006

01/1/2006

01/1/06

I hope this helps


no, i m not inserting any date... when sumone gets registered to the system.. the stored procedure gets the date using function getdate() and i m just selecting it using .. a datareader and puting it in

sqlDateTime type variable... it is working perfectly in local pc.. that is sql server 2000 same is on the SERVER pcc... but i found one difference that in my pc it is storing date as mm/dd/yy and on server pc it is generating date using getdate() as yy/dd/mm... although did't change any settings....

and this format of yy/dd/mm is giving error when i retrieve it in variable sqlDateTime in asp.net!

even if i change its format in selection... then i wont work on my local pc.. because sql server on my local pc is generating date using getdate() as mm/dd/yy...

any help ?

thanks

Monday, March 26, 2012

Strings and wildcard

I am doing some things with page url's, and of couse, I test on the local host.
Only thing is, when I post to the server, the name of the host chages.

I can do an if x or y then.... but as usual, want to save code space and incase the name of the server changes, need to do something else.

What I have been searching for, unsuccessfully, is a way to insert the wildcard * into the string... such as...

If myurl = "http://" & * & "pagename.aspx" Then

Well, the * is not declared and can't seem to find how to tell the string doesn't matter the host name.

Suggestions?

Thanks all,

ZathI don't recommend approaching this problem with a wildcard. There is a simpler solution.
Try something along these lines:

 Dim requestedUrl As String = System.Web.HttpContext.Current.Request.Path.ToLower()
Select Case requestedUrl
Case "default.aspx"
' settings for homepage
Case "about.aspx"
' settings for about page
Case "contact.aspx"
' settings for contact page
Case Else
' settings for page not found
End Select
The long first line will give us the requested URL, but without the host and application name.
So this ignores the host and application name, in the same way your wildcard would have done.

I hope this helps.
Thanks!

That works even better!

After posting the message, I was actually looking for a way to get the host name to input it that way and solve the problem.

Zath
The following is a test page that I use quite often.
It allows me to see various Request and HTTP values.

In situations such as the above, you can look at the results of this test page,
and see whether there are any existing values that will match your needs.

For example, this test page will show you which Request property to use if
your URL testing also takes into account QueryStrings.

Anyway, I thought that the following may help you.

<%@. Page Language="C#" Debug="True" Trace="True" %><html>
<head>
</head>
<body>
<h2>Request Report</h2>
<hr />
<p><asp:Label id="Message" runat="server" /></p>
</body>
</html>
<script runat="server">
public void Page_Load (object sender, EventArgs e)
{
Message.Text += "Page.Request.ApplicationPath: " + Page.Request.ApplicationPath + "<br " + "/>";
Message.Text += "Page.Request.FilePath: " + Page.Request.FilePath + "<br " + "/>";
Message.Text += "Page.Request.Path: " + Page.Request.Path + "<br " + "/>";
Message.Text += "Page.Request.PathInfo: " + Page.Request.PathInfo + "<br " + "/>";
Message.Text += "Page.Request.PhysicalApplicationPath: " + Page.Request.PhysicalApplicationPath + "<br " + "/>";
Message.Text += "Page.Request.PhysicalPath: " + Page.Request.PhysicalPath + "<br " + "/>";
Message.Text += "Page.Request.RawUrl: " + Page.Request.RawUrl + "<br " + "/>";
Message.Text += "Page.Request.UserAgent: " + Page.Request.UserAgent + "<br " + "/>";
Message.Text += "Page.Request.UserHostAddress: " + Page.Request.UserHostAddress + "<br " + "/>";
Message.Text += "Page.Request.UserHostName: " + Page.Request.UserHostName + "<br " + "/>";
Message.Text += "Page.Request.Url.AbsolutePath: " + Page.Request.Url.AbsolutePath + "<br " + "/>";
Message.Text += "Page.Request.Url.Host: " + Page.Request.Url.Host + "<br " + "/>";
Message.Text += "Page.Request.Url.LocalPath: " + Page.Request.Url.LocalPath + "<br " + "/>";
Message.Text += "Page.Request.Url.PathAndQuery: " + Page.Request.Url.PathAndQuery + "<br " + "/>";
Message.Text += "<br " + "/>";

Message.Text += "<hr />Request.UrlReferrer<br>";
if (Request.UrlReferrer != null)
{
Uri referrer = Request.UrlReferrer;
Message.Text += "Request.UrlReferrer.AbsolutePath: " + referrer.AbsolutePath + "<br>";
Message.Text += "Request.UrlReferrer.AbsoluteUri: " + referrer.AbsoluteUri + "<br>";
Message.Text += "Request.UrlReferrer.Authority: " + referrer.Authority + "<br>";
Message.Text += "Request.UrlReferrer.Fragment: " + referrer.Fragment + "<br>";
Message.Text += "Request.UrlReferrer.Host: " + referrer.Host + "<br>";
Message.Text += "Request.UrlReferrer.LocalPath: " + referrer.LocalPath + "<br>";
Message.Text += "Request.UrlReferrer.PathAndQuery: " + referrer.PathAndQuery + "<br>";
Message.Text += "Request.UrlReferrer.Query: " + referrer.Query + "<br>";
Message.Text += "Request.UrlReferrer.Scheme: " + referrer.Scheme + "<br>";
Message.Text += "Request.UrlReferrer.UserInfo: " + referrer.UserInfo + "<br>";
Message.Text += "<br " + "/>";
}

Message.Text += "<hr />Request.Headers" + "<br " + "/>";
OutputCollection(Request.Headers);

Message.Text += "<hr />Request.Browser" + "<br " + "/>";
HttpBrowserCapabilities bc = Request.Browser;
Message.Text += "Type = " + bc.Type + "<br>";
Message.Text += "Name = " + bc.Browser + "<br>";
Message.Text += "Version = " + bc.Version + "<br>";
Message.Text += "Major Version = " + bc.MajorVersion + "<br>";
Message.Text += "Minor Version = " + bc.MinorVersion + "<br>";
Message.Text += "Platform = " + bc.Platform + "<br>";
Message.Text += "Is Beta = " + bc.Beta + "<br>";
Message.Text += "Is Crawler = " + bc.Crawler + "<br>";
Message.Text += "Is AOL = " + bc.AOL + "<br>";
Message.Text += "Is Win16 = " + bc.Win16 + "<br>";
Message.Text += "Is Win32 = " + bc.Win32 + "<br>";
Message.Text += "Supports Frames = " + bc.Frames + "<br>";
Message.Text += "Supports Tables = " + bc.Tables + "<br>";
Message.Text += "Supports Cookies = " + bc.Cookies + "<br>";
Message.Text += "Supports VB Script = " + bc.VBScript + "<br>";
Message.Text += "Supports JavaScript = " + bc.JavaScript + "<br>";
Message.Text += "Supports Java Applets = " + bc.JavaApplets + "<br>";
Message.Text += "Supports ActiveX Controls = " + bc.ActiveXControls + "<br>";
Message.Text += "CDF = " + bc.CDF + "<br>";

Message.Text += "<hr />Request.ServerVariables" + "<br " + "/>";
OutputCollection(Request.ServerVariables);

}

private void OutputCollection(NameValueCollection coll)
{
int loop1, loop2;
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1<arr1.Length; loop1++)
{
Message.Text += "Key: " + arr1[loop1] + "<br " + "/>";
// Get all values under this key.
String[] arr2=coll.GetValues(arr1[loop1]);
for (loop2 = 0; loop2<arr2.Length; loop2++)
{
Message.Text += "Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br " + "/>" + "<br " + "/>";
}
}
}
</script>


Don't you think usingTrace would be simpler for this?
> Don't you think using Trace would be simpler for this?

The test page does have tracing turned on, so trace information is included on the page.

But Trace alone will not show the value of the Request's properties, or the Request.UrlReferrer's properties.

I know that much of my output is redundant for a page with Trace output. But the idea is tosee how the values in the HTTP headers and the form collection translate into the various properties available in the current Request object.

A simple page like this excuses me from having to remember which of the Request properties include the querystring, and which do not. Even though it was a test page I made when I was new to ASP.NET, I still find it helpful. I simply thought it may help the original poster, too.
Thanks SomeNewKid, that test page does help a LOT!

Yes, it is because I am doing a new user email confirm activate new account page.
The URL will have a querry sting in it for confirmation.

Zath

Saturday, March 24, 2012

Stripping Needless Data From HttpContext.Current.Request.Form

I found this nice example of printing data to the default printer of the server when the submit button is clicked. But not sure how to strip out the names of the controls, etc.

Here is the code for those interested:

1Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)23 Dim yPos As Single = 2504 Dim leftMargin As Single = ev.MarginBounds.Left5 Dim topMargin As Single = ev.MarginBounds.Top6 Dim printFont = New Font("Arial", 10)78 Dim sb As StringBuilder = New StringBuilder()910 ' Page title and date/time.11 sb.Append("Maintenance Request")12 sb.Append(Environment.NewLine)13 sb.Append("DateTime: " + DateTime.Now.ToString() + Environment.NewLine)1415 ' Iterate submitted form fields and get field names.16 Dim fieldValue As String17 Dim fieldName As String1819 ' Exclude viewstate and submit button.20 For Each fieldName In HttpContext.Current.Request.Form21 Response.Write("Field Name: " & HttpContext.Current.Request.Form(fieldName) & "<br>")22 If fieldName = "__VIEWSTATE" Or fieldName = "Submit" Then2324 Else25 ' Get the field values.2627 fieldValue = HttpContext.Current.Request.Form(fieldName)2829 ' Add the field names and values to the page.30 ' Break the field values into 50 character segments so it will fit on the paper.31 ' Currently, this only accounts for fields of l50 characters or less.32 ' ISSUE: breaks in the middle of words instead of spaces3334 If fieldValue.Length > 100 Then35 sb.Append(fieldName + ": " + fieldValue.Substring(0, 50) + Environment.NewLine)36 sb.Append(" " + fieldValue.Substring(50, 50) + Environment.NewLine)37 sb.Append(" " + fieldValue.Substring(100, fieldValue.Length - 100) + Environment.NewLine)3839 ElseIf fieldValue.Length > 50 Then40 sb.Append(fieldName + ": " + fieldValue.Substring(0, 50) + Environment.NewLine)41 sb.Append(" " + fieldValue.Substring(50, fieldValue.Length - 50) + Environment.NewLine)42 Else43 sb.Append(fieldName + ": " + fieldValue + Environment.NewLine)4445 End If4647 End If4849 Next50 ev.Graphics.DrawString(sb.ToString(), printFont, Brushes.Black, leftMargin, yPos, New StringFormat())5152 End Sub
 
There has to be a better way. Any ideas?
Figured it out. Instead of using HttpContext.Current.Request.Form, I am just using the explicit names of the controls and appending the values to the stringbuilder. If anyone needs help with this, please feel free to contact me.Big Smile

Thursday, March 22, 2012

Strong Password encryption program?

I have a web-based program that will be going to an external web server and
want to create a logon process. I am using forms authentication, passing
encryption with salt, but want to force the user to create passwords with
rules: combinations of numbers & letters, at least one character caps,
things like that, like we would on a a network, and to change the password
every x amount of months. Can anyone point me in the right direction as to
any articles that may help me do this, or the correct process?

Thanks for your help.This is handled at multiple places:

1) Forms authentication allows a user to login into the system for a
session or for a certain amount of time. The way you are handling is
good enough.
2) To have a set of rules for a password, you may use regular
expressions on ASP.NET password textboxes. Search google.
Alternatively, you can write your own logic to validate in code-behind
file or have a trigger in the database of password field, that verifies
the requirement.
3) Password expiry should be maintained by your database logic.
Whenever, a password is updated, update the last updated date and
whenever user login, check if the last updated date is beyond the valid
date time frame. If so, force user to create a new password.

If there are any other ways, please contribute. I'll love to know more
varieties.

Thanks,
Aru
Hello KatMagic,

If you haven't already, take a look at the SqlMembershipProvider api in
ASP.NET 2.0. It has some of what you want built in:

> Configurable password strength
> Automatic lockout
> Minimum number of non-alphanumeric
> Security question/answer
> ...

The membership data are stored in SQL so you have access to the tables,
stored procedures, and functions if you want to customize.

--
enjoy - brians
http://www.limbertech.com

Strong Password encryption program?

I have a web-based program that will be going to an external web server and
want to create a logon process. I am using forms authentication, passing
encryption with salt, but want to force the user to create passwords with
rules: combinations of numbers & letters, at least one character caps,
things like that, like we would on a a network, and to change the password
every x amount of months. Can anyone point me in the right direction as to
any articles that may help me do this, or the correct process?
Thanks for your help.This is handled at multiple places:
1) Forms authentication allows a user to login into the system for a
session or for a certain amount of time. The way you are handling is
good enough.
2) To have a set of rules for a password, you may use regular
expressions on ASP.NET password textboxes. Search google.
Alternatively, you can write your own logic to validate in code-behind
file or have a trigger in the database of password field, that verifies
the requirement.
3) Password expiry should be maintained by your database logic.
Whenever, a password is updated, update the last updated date and
whenever user login, check if the last updated date is beyond the valid
date time frame. If so, force user to create a new password.
If there are any other ways, please contribute. I'll love to know more
varieties.
Thanks,
Aru
Hello KatMagic,
If you haven't already, take a look at the SqlMembershipProvider api in
ASP.NET 2.0. It has some of what you want built in:

> Configurable password strength
> Automatic lockout
> Minimum number of non-alphanumeric
> Security question/answer
> ...
The membership data are stored in SQL so you have access to the tables,
stored procedures, and functions if you want to customize.
enjoy - brians
http://www.limbertech.com

Tuesday, March 13, 2012

stuck on this one

I posted this before and it didn't help.
I have a web site in .NET that runs under a virtual directory on my server.
In IIS I virtual pointing to the physical path where the .aspx pages. How
can I the path of the virtual directory and not the physical path?
I have links on my asp.net web form that needs to link to
http://webserver/invoices/page.aspx. I'm getting
c:\site\invoices\pages.aspx. I tried to do a server.mappath and that does
not work. Any suggestions/If you have a link to Page.aspx then just create a hyperlink like this:
<a href="http://links.10026.com/?link=Page.aspx?action=whatever">Text / Image</a>
could you show how you are getting these files listed?
If you are using a file system object to get these you will need to know the
root/starting point, then just append the appropriate DIR to it.
There is no solid way to have the system say that:
c:\dir\dir2\file.ext = http://virt/file.ext
since there could be more then one virtual mapping included to the same
files/folders.
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"NuB" wrote:

> I posted this before and it didn't help.
> I have a web site in .NET that runs under a virtual directory on my server
.
> In IIS I virtual pointing to the physical path where the .aspx pages. How
> can I the path of the virtual directory and not the physical path?
> I have links on my asp.net web form that needs to link to
> http://webserver/invoices/page.aspx. I'm getting
> c:\site\invoices\pages.aspx. I tried to do a server.mappath and that does
> not work. Any suggestions/
>
>

stuck on this one

I posted this before and it didn't help.

I have a web site in .NET that runs under a virtual directory on my server.
In IIS I virtual pointing to the physical path where the .aspx pages. How
can I the path of the virtual directory and not the physical path?

I have links on my asp.net web form that needs to link to
http://webserver/invoices/page.aspx. I'm getting
c:\site\invoices\pages.aspx. I tried to do a server.mappath and that does
not work. Any suggestions/If you have a link to Page.aspx then just create a hyperlink like this:

<a href="http://links.10026.com/?link=Page.aspx?action=whatever">Text / Image</a
could you show how you are getting these files listed?
If you are using a file system object to get these you will need to know the
root/starting point, then just append the appropriate DIR to it.
There is no solid way to have the system say that:
c:\dir\dir2\file.ext = http://virt/file.ext
since there could be more then one virtual mapping included to the same
files/folders.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"NuB" wrote:

> I posted this before and it didn't help.
> I have a web site in .NET that runs under a virtual directory on my server.
> In IIS I virtual pointing to the physical path where the .aspx pages. How
> can I the path of the virtual directory and not the physical path?
> I have links on my asp.net web form that needs to link to
> http://webserver/invoices/page.aspx. I'm getting
> c:\site\invoices\pages.aspx. I tried to do a server.mappath and that does
> not work. Any suggestions/
>
>

Stuck on XML/XSLT with Asp.net 1.1 server controls.

Hello everyone,

I am working on a custom built portal system in Visual Studio 2003 and I amstuck on how to develop with XML/XSLT and using Asp.net server controls. Theportal consists of "applications" (each application is essentially a.aspx page) and those applications consists of "modules" (whichderives from UserControl). Now in order to maintain a consistent look for allmodules/applications and to minimize the amount of actual html hard coded, Iwant to use XSLT (which would contain the html) and CSS to help generate thatconsistent appearance. TheModule class containstitle andbodyfields, wherebodycan have any form of content (html/text/javascript),but sinceModulederives from UserControl, it can also contain .Net childcontrols, and I need those child controls to render correctly to take fulladvantage of Asp.Net. What would be the best approach to accomplish this inwhich the module would be transformed using a XSL file?


This also needs to apply to an application as well (or atleast the layout of the application, something that controls the placement ofthe modules). If I have a collection of modules, I need to put them in someform of structure or layout and transform that layout through an XSL file tohave a consistent look and only one place to look when we need to change thelook of a module or application. What would be the best approach for this orcould you point me in the right direction? If you need any furtherclarification, I would be more than willing to help. Thanks in advance!

Steve

Wow that was a lot...

Was there a specific bit of coding that you are stuck on or are you looking for a broadranged theory?


If you'd like I can tell you what I have right now, but I'mthinking it may be better to take a step back and look at it from a differentangle.Smile [:)] The first question is best approach to take a user control that contains child controls and other content, run it through an .xsl file, and have it display properly on the page. Thanks for your help!


User controls containing child controls is nothing special... in fact really just about every User Control ever made has child controls. User Controls, with User Controls would be nothing different really either...

Let me see if I have it right, before I comment...

You want your XML to contain the list of what's on each control, and the XSL to contain the "way" that the controls display? Is that correct?

And you are wondering if this is a good approach?

Stuck with launching IE from Web App

PROBLEM # 1:
------
I am trying to launch a website in IE on the server from a C#/ASP.NET
web service. I am using the System.Diagnostics namespace and the
Process class methods. The IE process DOES seem to be running (since
there are IExplore.exe entries in the Task Manager), but no matter what
I do, there is no window on the screen (I cant see it). Here's the
code:

<code>
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName= @dotnet.itags.org."C:\Program Files\Internet
Explorer\IEXPLORE.exe";
proc.StartInfo.Arguments="http://www.mysite.com";
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
proc.Start();
</code
From what I've seen online, some ppl claimed to have done it
successfully while others said it is not possible to execute
applications from a web-based application (<a
href="http://www.dotnet247.com/247reference/msgs/20/103726.aspx">See
Here</a>). Can someone please confirm if it is really possible or not?

I do notice that all the IE processes in the Task Manager that my web
service "runs", the user is "NETWORK SERVICE", while the user for the IE
process that I manually open is "Administrator". Is this enough proof
that it is not possible. I would like to know how some ppl were able to
do it.

PROBLEM # 2
------
Well, the fact that the IE application does run in a hidden manner
(Problem # 1) is actually more preferable for me <b>IF</b> there is some
why that I can save the HTML file that is supposedly loaded into IE.
For example, if I could actually see the IE window, I would write a
script that would select FILE -> SAVE AS and so on...
However, without seeing the window, is there a way I can save the HTML
file being "displayed"?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!check out this support link,
http://support.microsoft.com/defaul...kb;en-us;555134

"James N" <email_this_guy@.yahoo.com> wrote in message
news:#ssrBwuuEHA.3376@.TK2MSFTNGP12.phx.gbl...
> PROBLEM # 1:
> ------
> I am trying to launch a website in IE on the server from a C#/ASP.NET
> web service. I am using the System.Diagnostics namespace and the
> Process class methods. The IE process DOES seem to be running (since
> there are IExplore.exe entries in the Task Manager), but no matter what
> I do, there is no window on the screen (I cant see it). Here's the
> code:
> <code>
> System.Diagnostics.Process proc = new System.Diagnostics.Process();
> proc.StartInfo.FileName= @."C:\Program Files\Internet
> Explorer\IEXPLORE.exe";
> proc.StartInfo.Arguments="http://www.mysite.com";
> proc.StartInfo.CreateNoWindow = false;
> proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
> proc.Start();
> </code>
> From what I've seen online, some ppl claimed to have done it
> successfully while others said it is not possible to execute
> applications from a web-based application (<a
> href="http://links.10026.com/?link=http://www.dotnet247.com/247reference/msgs/20/103726.aspx">See
> Here</a>). Can someone please confirm if it is really possible or not?
> I do notice that all the IE processes in the Task Manager that my web
> service "runs", the user is "NETWORK SERVICE", while the user for the IE
> process that I manually open is "Administrator". Is this enough proof
> that it is not possible. I would like to know how some ppl were able to
> do it.
> PROBLEM # 2
> ------
> Well, the fact that the IE application does run in a hidden manner
> (Problem # 1) is actually more preferable for me <b>IF</b> there is some
> why that I can save the HTML file that is supposedly loaded into IE.
> For example, if I could actually see the IE window, I would write a
> script that would select FILE -> SAVE AS and so on...
> However, without seeing the window, is there a way I can save the HTML
> file being "displayed"?
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Thanks for your help. However, I already saw that MS article. And I
already tried it. It didn't work because I later realize that it's only
for II 5.0. IIS 6.0 uses a different worker process scheme. I havent
been able to find any similar article for II6 yet.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Stuck with launching IE from Web App

PROBLEM # 1:
--
I am trying to launch a website in IE on the server from a C#/ASP.NET
web service. I am using the System.Diagnostics namespace and the
Process class methods. The IE process DOES seem to be running (since
there are IExplore.exe entries in the Task Manager), but no matter what
I do, there is no window on the screen (I cant see it). Here's the
code:
<code>
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName= @dotnet.itags.org."C:\Program Files\Internet
Explorer\IEXPLORE.exe";
proc.StartInfo.Arguments="http://www.mysite.com";
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
proc.Start();
</code>
From what I've seen online, some ppl claimed to have done it
successfully while others said it is not possible to execute
applications from a web-based application (<a
href="http://www.dotnet247.com/247reference/msgs/20/103726.aspx">See
Here</a> ). Can someone please confirm if it is really possible or not?
I do notice that all the IE processes in the Task Manager that my web
service "runs", the user is "NETWORK SERVICE", while the user for the IE
process that I manually open is "Administrator". Is this enough proof
that it is not possible. I would like to know how some ppl were able to
do it.
PROBLEM # 2
--
Well, the fact that the IE application does run in a hidden manner
(Problem # 1) is actually more preferable for me <b>IF</b> there is some
why that I can save the HTML file that is supposedly loaded into IE.
For example, if I could actually see the IE window, I would write a
script that would select FILE -> SAVE AS and so on...
However, without seeing the window, is there a way I can save the HTML
file being "displayed"?
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!check out this support link,
http://support.microsoft.com/defaul...kb;en-us;555134
"James N" <email_this_guy@.yahoo.com> wrote in message
news:#ssrBwuuEHA.3376@.TK2MSFTNGP12.phx.gbl...
> PROBLEM # 1:
> --
> I am trying to launch a website in IE on the server from a C#/ASP.NET
> web service. I am using the System.Diagnostics namespace and the
> Process class methods. The IE process DOES seem to be running (since
> there are IExplore.exe entries in the Task Manager), but no matter what
> I do, there is no window on the screen (I cant see it). Here's the
> code:
> <code>
> System.Diagnostics.Process proc = new System.Diagnostics.Process();
> proc.StartInfo.FileName= @."C:\Program Files\Internet
> Explorer\IEXPLORE.exe";
> proc.StartInfo.Arguments="http://www.mysite.com";
> proc.StartInfo.CreateNoWindow = false;
> proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
> proc.Start();
> </code>
> From what I've seen online, some ppl claimed to have done it
> successfully while others said it is not possible to execute
> applications from a web-based application (<a
> href="http://links.10026.com/?link=http://www.dotnet247.com/247reference/msgs/20/103726.aspx">See
> Here</a> ). Can someone please confirm if it is really possible or not?
> I do notice that all the IE processes in the Task Manager that my web
> service "runs", the user is "NETWORK SERVICE", while the user for the IE
> process that I manually open is "Administrator". Is this enough proof
> that it is not possible. I would like to know how some ppl were able to
> do it.
> PROBLEM # 2
> --
> Well, the fact that the IE application does run in a hidden manner
> (Problem # 1) is actually more preferable for me <b>IF</b> there is some
> why that I can save the HTML file that is supposedly loaded into IE.
> For example, if I could actually see the IE window, I would write a
> script that would select FILE -> SAVE AS and so on...
> However, without seeing the window, is there a way I can save the HTML
> file being "displayed"?
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
Thanks for your help. However, I already saw that MS article. And I
already tried it. It didn't work because I later realize that it's only
for II 5.0. IIS 6.0 uses a different worker process scheme. I havent
been able to find any similar article for II6 yet.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!